0 terminate the last byte, and copy at most size-1.
(or 0 terminate the last byte after copying upto size bytes)
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
while (path[i] != '\\' && path[i] != '/' && i >= 0)
i--;
- strncpy(name, path + i + 1, MAX_PATH);
+ name[MAX_PATH - 1] = '\0';
+ strncpy(name, path + i + 1, MAX_PATH - 1);
return name;
}
#ifdef CONFIG_BIG_ENDIAN
probe.bigendian = 1;
#endif
- strncpy((char *) probe.fio_version, fio_version_string, sizeof(probe.fio_version));
+ strncpy((char *) probe.fio_version, fio_version_string, sizeof(probe.fio_version) - 1);
probe.os = FIO_OS;
probe.arch = FIO_ARCH;