threads / patch / 48259

patchfsmonitor: fix incorrect buffer size when printing version number

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

## tl;dr

4 messages between Apr 10, 2018 and Apr 16, 2018. Diffs are folded; open one to read it.

replies: 3people: 3as markdown or json

Ben Peart· Apr 10, 2018, 18:43 UTC · lore

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(-)
Show changes to fsmonitor.c +1 −1
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
Eric Sunshine· Apr 10, 2018, 20:17 UTC · re: Ben Peart · lore

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

On Tue, Apr 10, 2018 at 2:43 PM, Ben Peart <Ben.Peart@microsoft.com> wrote:
> 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/
> rather than the size of the value being printed.
>
> Signed-off-by: Ben Peart <benpeart@microsoft.com>
Ben Peart· Apr 13, 2018, 12:18 UTC · re: Eric Sunshine · lore

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

On 4/10/2018 4:17 PM, Eric Sunshine wrote:
Show 9 quoted lines
> On Tue, Apr 10, 2018 at 2:43 PM, Ben Peart <Ben.Peart@microsoft.com> wrote:
>> 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/
> 
>> rather than the size of the value being printed.
>>
>> Signed-off-by: Ben Peart <benpeart@microsoft.com>

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

Junio C Hamano· Apr 16, 2018, 01:00 UTC · re: Ben Peart · lore

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

Ben Peart <peartben@gmail.com> writes:
Show 13 quoted lines
> On 4/10/2018 4:17 PM, Eric Sunshine wrote:
>> On Tue, Apr 10, 2018 at 2:43 PM, Ben Peart <Ben.Peart@microsoft.com> wrote:
>>> 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/
>>
>>> rather than the size of the value being printed.
>>>
>>> Signed-off-by: Ben Peart <benpeart@microsoft.com>
>
> 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.

← back to recent threads