From: Jens Axboe Date: Mon, 14 Apr 2014 14:54:09 +0000 (-0600) Subject: server: fix potential buffer overrun in bind string X-Git-Tag: fio-2.1.9~56 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=afdcad2315c22200d594a29885053d7671881ebb;hp=1cb964148482b2d50b1f82966f96545ebeec6428 server: fix potential buffer overrun in bind string Signed-off-by: Jens Axboe --- diff --git a/server.c b/server.c index c2cf2ddd..9442764e 100644 --- a/server.c +++ b/server.c @@ -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);