This commit silences the following Coverity warning:
CID
1412118 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING)6. buffer_size_warning: Calling strncpy with a
maximum size argument of 4096 bytes on destination array mount->name of
size 4096 bytes might leave the destination string unterminated.
Note that there are several areas (including this piece of code)
in libcgroup that do not gracefully handle string truncation. That
will be addressed in future patches.
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
if (controller == NULL)
break;
strncpy(mount->name, controller, sizeof(mount->name));
+ mount->name[sizeof(mount->name)-1] = '\0';
}
if (strncmp(token, "nodev", strlen("nodev")) == 0) {