verify: verify_state_gen_name() should check size

Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/server.c b/server.c
index a8d4868..c4ab906 100644
--- a/server.c
+++ b/server.c
@@ -1391,7 +1391,8 @@
 	rep->data = NULL;
 	rep->error = 0;
 
-	verify_state_gen_name((char *) out.path, name, me, threadnumber);
+	verify_state_gen_name((char *) out.path, sizeof(out.path), name, me,
+				threadnumber);
 	tag = (uint64_t) (uintptr_t) rep;
 	fio_net_send_cmd(server_fd, FIO_NET_CMD_SENDFILE, &out, sizeof(out),
 				&tag, NULL);
diff --git a/verify.c b/verify.c
index a0c2e38..f05e85d 100644
--- a/verify.c
+++ b/verify.c
@@ -1375,7 +1375,7 @@
 	else
 		flags = O_RDONLY;
 
-	verify_state_gen_name(out, name, prefix, num);
+	verify_state_gen_name(out, sizeof(out), name, prefix, num);
 
 	fd = open(out, flags, 0644);
 	if (fd == -1) {
diff --git a/verify.h b/verify.h
index 3e52f9c..43de887 100644
--- a/verify.h
+++ b/verify.h
@@ -138,10 +138,12 @@
 	return (void *) s + thread_io_list_sz(s);
 }
 
-static inline void verify_state_gen_name(char *out, const char *name,
-					 const char *prefix, int num)
+static inline void verify_state_gen_name(char *out, size_t size,
+					 const char *name, const char *prefix,
+					 int num)
 {
-	sprintf(out, "%s-%s-%d-verify.state", prefix, name, num);
+	snprintf(out, size, "%s-%s-%d-verify.state", prefix, name, num);
+	out[size - 1] = '\0';
 }
 
 #endif