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.hromatka@oracle.com>
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;
}