From: Jens Axboe Date: Mon, 14 Apr 2014 17:45:34 +0000 (-0600) Subject: server: ensure that incoming iolog name is NULL terminated X-Git-Tag: fio-2.1.9~39 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=9bdb9265ed6cfd95fc217a9030b188a5a345cc89 server: ensure that incoming iolog name is NULL terminated Signed-off-by: Jens Axboe --- diff --git a/server.c b/server.c index f65f3abf..077dce5c 100644 --- a/server.c +++ b/server.c @@ -1225,7 +1225,9 @@ int fio_send_iolog(struct thread_data *td, struct io_log *log, const char *name) pdu.nr_samples = __cpu_to_le32(log->nr_samples); pdu.log_type = cpu_to_le32(log->log_type); pdu.compressed = cpu_to_le32(use_zlib); - strcpy((char *) pdu.name, name); + + strncpy((char *) pdu.name, name, FIO_NET_NAME_MAX); + pdu.name[FIO_NET_NAME_MAX - 1] = '\0'; for (i = 0; i < log->nr_samples; i++) { struct io_sample *s = &log->log[i];