These formatted integers should always fit into their
64-byte buffers. Let's use xsnprintf() to add an assertion
that this is the case, which makes auditing for other
unchecked snprintfs() easier.

Signed-off-by: Jeff King <p...@peff.net>
---
 fsmonitor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fsmonitor.c b/fsmonitor.c
index ed3d1a074d..cc19b27e1d 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -104,8 +104,8 @@ static int query_fsmonitor(int version, uint64_t 
last_update, struct strbuf *que
        if (!(argv[0] = core_fsmonitor))
                return -1;
 
-       snprintf(ver, sizeof(ver), "%d", version);
-       snprintf(date, sizeof(date), "%" PRIuMAX, (uintmax_t)last_update);
+       xsnprintf(ver, sizeof(ver), "%d", version);
+       xsnprintf(date, sizeof(date), "%" PRIuMAX, (uintmax_t)last_update);
        argv[1] = ver;
        argv[2] = date;
        argv[3] = NULL;
-- 
2.17.0.1052.g7d69f75dbf

Reply via email to