X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=server.c;h=2fa51dff475b013202f0ca2b3b72324a2b07cebe;hp=c2cf2ddd9d557e7e915083be0f10c8aaf46963de;hb=a48fddbcb33991f9b2d1be1fa0a5e5cfb9ea9fae;hpb=59140421267ef809b00da12881b8d899ecefbb10 diff --git a/server.c b/server.c index c2cf2ddd..2fa51dff 100644 --- a/server.c +++ b/server.c @@ -1339,7 +1339,7 @@ static int fio_init_server_sock(void) memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; - strcpy(addr.sun_path, bind_sock); + strncpy(addr.sun_path, bind_sock, sizeof(addr.sun_path) - 1); len = sizeof(addr.sun_family) + strlen(bind_sock) + 1; @@ -1368,6 +1368,8 @@ static int fio_init_server_connection(void) if (sk < 0) return sk; + memset(bind_str, 0, sizeof(bind_str)); + if (!bind_sock) { char *p, port[16]; const void *src; @@ -1387,9 +1389,9 @@ static int fio_init_server_connection(void) if (p) strcat(p, port); else - strcpy(bind_str, port); + strncpy(bind_str, port, sizeof(bind_str) - 1); } else - strcpy(bind_str, bind_sock); + strncpy(bind_str, bind_sock, sizeof(bind_str) - 1); log_info("fio: server listening on %s\n", bind_str);