verify: verify_state_gen_name() should check size
Signed-off-by: Jens Axboe <axboe@fb.com>
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