git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v1] fsmonitor: fix incorrect buffer size when printing version number

From
Ben Peart <ben.peart@microsoft.com>
Date
Apr 10, 2018, 18:43 UTC
Message-ID
<20180410184327.13896-1-benpeart@microsoft.com>

This is a trivial bug fix for passing the incorrect size to snprintf() when outputing the version. It should be passing the size of the destination buffer rather than the size of the value being printed.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
---
Notes:
    Base Ref: v2.17.0
    Web-Diff: https://github.com/benpeart/git/commit/0bc3fc3b74
    Checkout: git fetch https://github.com/benpeart/git fsmonitor-version-v1 && git checkout 0bc3fc3b74
 fsmonitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fsmonitor.c b/fsmonitor.c
index 6d7bcd5d0e..eb4e642256 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -104,7 +104,7 @@ static int query_fsmonitor(int version, uint64_t last_update, struct strbuf *que
 	if (!(argv[0] = core_fsmonitor))
 		return -1;
 
-	snprintf(ver, sizeof(version), "%d", version);
+	snprintf(ver, sizeof(ver), "%d", version);
 	snprintf(date, sizeof(date), "%" PRIuMAX, (uintmax_t)last_update);
 	argv[1] = ver;
 	argv[2] = date;

base-commit: 468165c1d8a442994a825f3684528361727cd8c0
-- 
2.17.0.windows.1
Next: Eric Sunshine
Message 1 of 4 in “fsmonitor: fix incorrect buffer size when printing version number”
  1. fsmonitor: fix incorrect buffer size when printing version numberBen Peart, Apr 10, 2018
  2. Eric SunshineApr 10, 2018
  3. Ben PeartApr 13, 2018
  4. Junio C HamanoApr 16, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.