X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fvm_power_manager%2Fchannel_manager.c;h=a26315051b54d88488a8f50dd04c43375c1bec50;hb=6a2cf58a045f58c9744194f4d44394c7af1a0027;hp=4ac21f02c1a9820773dd59e6225c8b4da46a5304;hpb=1deb502e54634bf375b047a293e4cb393372dc6c;p=dpdk.git diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c index 4ac21f02c1..a26315051b 100644 --- a/examples/vm_power_manager/channel_manager.c +++ b/examples/vm_power_manager/channel_manager.c @@ -4,7 +4,6 @@ #include #include -#include #include #include #include @@ -35,6 +34,8 @@ #define RTE_LOGTYPE_CHANNEL_MANAGER RTE_LOGTYPE_USER1 +struct libvirt_vm_info lvm_info[MAX_CLIENTS]; + /* Global pointer to libvirt connection */ static virConnectPtr global_vir_conn_ptr; @@ -466,9 +467,15 @@ add_all_channels(const char *vm_name) continue; } - snprintf(chan_info->channel_path, + if ((size_t)snprintf(chan_info->channel_path, sizeof(chan_info->channel_path), "%s%s", - CHANNEL_MGR_SOCKET_PATH, dir->d_name); + CHANNEL_MGR_SOCKET_PATH, dir->d_name) + >= sizeof(chan_info->channel_path)) { + RTE_LOG(ERR, CHANNEL_MANAGER, "Pathname too long for channel '%s%s'\n", + CHANNEL_MGR_SOCKET_PATH, dir->d_name); + rte_free(chan_info); + continue; + } if (setup_channel_info(&vm_info, &chan_info, channel_num) < 0) { rte_free(chan_info);