From: Tomohiro Kusumi <tkusumi@xxxxxxxxxx> 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@xxxxxxxxxx> --- os/windows/posix.c | 3 ++- server.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/os/windows/posix.c b/os/windows/posix.c index 488d0ed..00f0335 100755 --- a/os/windows/posix.c +++ b/os/windows/posix.c @@ -584,7 +584,8 @@ char *basename(char *path) 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; } diff --git a/server.c b/server.c index 0469cea..e6ea4cd 100644 --- a/server.c +++ b/server.c @@ -856,7 +856,7 @@ static int handle_probe_cmd(struct fio_net_cmd *cmd) #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; -- 2.9.5 -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html