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

4 messages from 2018-04-10 to 2018-04-16. Participants: Ben Peart, Eric Sunshine, Junio C Hamano.
Thread: https://gitlist.dev/t/48259

## Ben Peart, 2018-04-10 18:43

Subject: [PATCH v1] fsmonitor: fix incorrect buffer size when printing version number
Message-ID: <20180410184327.13896-1-benpeart@microsoft.com>
URL: https://gitlist.dev/e/20180410184327.13896-1-benpeart%40microsoft.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


```

## Eric Sunshine, 2018-04-10 20:17

Subject: Re: [PATCH v1] fsmonitor: fix incorrect buffer size when printing version number
Message-ID: <CAPig+cRvujJ2RmH62qnjS8asRn0wc+f-O+KA01NfFXuJDk3fog@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcRvujJ2RmH62qnjS8asRn0wc%2Bf-O%2BKA01NfFXuJDk3fog%40mail.gmail.com
In-Reply-To: <20180410184327.13896-1-benpeart@microsoft.com>

```
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, 2018-04-13 12:18

Subject: Re: [PATCH v1] fsmonitor: fix incorrect buffer size when printing version number
Message-ID: <2b6b2a54-8349-ea28-f752-4d752c798d5a@gmail.com>
URL: https://gitlist.dev/e/2b6b2a54-8349-ea28-f752-4d752c798d5a%40gmail.com
In-Reply-To: <CAPig+cRvujJ2RmH62qnjS8asRn0wc+f-O+KA01NfFXuJDk3fog@mail.gmail.com>

```


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?

```

## Junio C Hamano, 2018-04-16 01:00

Subject: Re: [PATCH v1] fsmonitor: fix incorrect buffer size when printing version number
Message-ID: <xmqqk1t8ynh6.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqk1t8ynh6.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <2b6b2a54-8349-ea28-f752-4d752c798d5a@gmail.com>

```
Ben Peart <peartben@gmail.com> writes:

> 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.

```
