From: Ben England Date: Thu, 8 Sep 2016 18:54:06 +0000 (-0400) Subject: safety first! X-Git-Tag: fio-2.14~4^2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=d9644df9f41ce6d16c50298dff04ede5ce110b63 safety first! --- diff --git a/client.c b/client.c index 410ffb89..82db5020 100644 --- a/client.c +++ b/client.c @@ -1302,12 +1302,15 @@ static int fio_client_handle_iolog(struct fio_client *client, return 1; } - /* generate a unique pathname for the log file using hostname */ - log_pathname = malloc(PATH_MAX+10); + /* allocate buffer big enough for next sprintf() call */ + log_pathname = malloc( 10 + + strlen((char * )pdu->name) + + strlen(client->hostname)); if (!log_pathname) { log_err("fio: memory allocation of unique pathname failed"); return -1; } + /* generate a unique pathname for the log file using hostname */ sprintf(log_pathname, "%s.%s", pdu->name, client->hostname); if (store_direct) {