This patch fixes the following Coverity warning: CID 1412155 (#1 of 1): Buffer not null terminated (BUFFER_SIZE_WARNING)4. buffer_size_warning: Calling strncpy with a maximum size argument of 100 bytes on destination array val->value of size 100 bytes might leave the destination string unterminated.
Signed-off-by: Tom Hromatka <tom.hroma...@oracle.com> --- src/wrapper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wrapper.c b/src/wrapper.c index 4f238367bfae..ee98ac5c70d9 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -407,6 +407,7 @@ int cgroup_set_value_string(struct cgroup_controller *controller, struct control_value *val = controller->values[i]; if (!strcmp(val->name, name)) { strncpy(val->value, value, CG_VALUE_MAX); + val->value[sizeof(val->value)-1] = '\0'; val->dirty = true; return 0; } -- 1.8.3.1 _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel