Skip to contentSkip to conversation

fsmonitor: fix incorrect buffer size when printing version number

PATCH In review Ben Peart 4 participants 4 messages Apr 10, 2018 – Apr 16, 2018

lore
Share & tools
lore

Ben Peart

author
#0 lore raw

PATCH 1/1 fsmonitor: fix incorrect buffer size when printing version number

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.

---

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(-)
fsmonitor.c +1 -1
index 6d7bcd5d0e..eb4e642256 100644
@@ -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

Signature · 1 line
2.17.0.windows.1
#1 lore raw
Quoted 2 lines · Ben Peart

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

s/outputing/outputting/

Quoted 3 lines

rather than the size of the value being printed.

#2 lore raw
Quoted 9 lines · Eric Sunshine
Quoted 2 lines · Ben Peart

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

s/outputing/outputting/

Quoted 3 lines

rather than the size of the value being printed.

Junio, do you want a re-roll of this simple fix or can you fix the spelling of the commit message?

#3 lore raw
Quoted 5 lines · Ben Peart
Quoted 4 lines · Eric Sunshine
Quoted 2 lines · Ben Peart

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

Quoted 8 lines
Quoted 5 lines

s/outputing/outputting/

Quoted 3 lines

rather than the size of the value being printed.

Junio, do you want a re-roll of this simple fix or can you fix the spelling of the commit message?

I think I already have that typofix in what is queued.

If there is anything more, I'd prefer to replace with a reroll ;-)

Thanks.