Bump length of description field to 256 chars
Ensure that string always end up \0 terminated, too.
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/server.c b/server.c
index dc70616..2f12162 100644
--- a/server.c
+++ b/server.c
@@ -987,9 +987,9 @@
memset(&p, 0, sizeof(p));
- strcpy(p.ts.name, ts->name);
- strcpy(p.ts.verror, ts->verror);
- strcpy(p.ts.description, ts->description);
+ strncpy(p.ts.name, ts->name, FIO_JOBNAME_SIZE - 1);
+ strncpy(p.ts.verror, ts->verror, FIO_VERROR_SIZE - 1);
+ strncpy(p.ts.description, ts->description, FIO_JOBDESC_SIZE - 1);
p.ts.error = cpu_to_le32(ts->error);
p.ts.thread_number = cpu_to_le32(ts->thread_number);
diff --git a/server.h b/server.h
index 8f79c14..3a279f0 100644
--- a/server.h
+++ b/server.h
@@ -38,7 +38,7 @@
};
enum {
- FIO_SERVER_VER = 32,
+ FIO_SERVER_VER = 33,
FIO_SERVER_MAX_FRAGMENT_PDU = 1024,
diff --git a/stat.c b/stat.c
index c2c717b..f84ce53 100644
--- a/stat.c
+++ b/stat.c
@@ -1232,12 +1232,12 @@
/*
* These are per-group shared already
*/
- strncpy(ts->name, td->o.name, FIO_JOBNAME_SIZE);
+ strncpy(ts->name, td->o.name, FIO_JOBNAME_SIZE - 1);
if (td->o.description)
strncpy(ts->description, td->o.description,
- FIO_JOBNAME_SIZE);
+ FIO_JOBDESC_SIZE - 1);
else
- memset(ts->description, 0, FIO_JOBNAME_SIZE);
+ memset(ts->description, 0, FIO_JOBDESC_SIZE);
/*
* If multiple entries in this group, this is
diff --git a/stat.h b/stat.h
index bc4f6da..3f68305 100644
--- a/stat.h
+++ b/stat.h
@@ -114,6 +114,7 @@
#define MAX_PATTERN_SIZE 512
#define FIO_JOBNAME_SIZE 128
+#define FIO_JOBDESC_SIZE 256
#define FIO_VERROR_SIZE 128
struct thread_stat {
@@ -123,7 +124,7 @@
uint32_t thread_number;
uint32_t groupid;
uint32_t pid;
- char description[FIO_JOBNAME_SIZE];
+ char description[FIO_JOBDESC_SIZE];
uint32_t members;
uint32_t unified_rw_rep;