[dpdk-dev,v2] examples/vm_power_manager: buffer not null terminated
Commit Message
CID30691:
If the buffer is treated as a null terminated string in later operations,
a buffer overflow or over-read may occur.
In add_vm: The string buffer may not have a null terminator if the source
string's length is equal to the buffer size
Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host")
Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
examples/vm_power_manager/channel_manager.c | 1 +
1 file changed, 1 insertion(+)
Comments
2016-05-10 17:49, Daniel Mrzyglod:
> CID30691:
> If the buffer is treated as a null terminated string in later operations,
> a buffer overflow or over-read may occur.
>
> In add_vm: The string buffer may not have a null terminator if the source
> string's length is equal to the buffer size
>
> Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host")
>
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Applied, thanks
@@ -667,6 +667,7 @@ add_vm(const char *vm_name)
return -1;
}
strncpy(new_domain->name, vm_name, sizeof(new_domain->name));
+ new_domain->name[sizeof(new_domain->name) - 1] = '\0';
new_domain->channel_mask = 0;
new_domain->num_channels = 0;