On Nov 2, 9:02am, p...@whooppee.com (Paul Goyette) wrote:
-- Subject: Re: CVS commit: src/sys/dev/pci
| Even in the non-overflow case, if you write x-1 chars (not including the
| trailing NUL) to a buffer of size x, the updated value of len will be 1
| (and dest would point to the last valid ch
On Tue, 1 Nov 2016, Christos Zoulas wrote:
On Nov 2, 8:49am, p...@whooppee.com (Paul Goyette) wrote:
-- Subject: Re: CVS commit: src/sys/dev/pci
| > Why *len = 1 here? Shouldn't it be 0 since there is no more room left?
|
| No. :)
|
| The maximum number of characters actually written by vsnpr
On Nov 2, 8:49am, p...@whooppee.com (Paul Goyette) wrote:
-- Subject: Re: CVS commit: src/sys/dev/pci
| > Why *len = 1 here? Shouldn't it be 0 since there is no more room left?
|
| No. :)
|
| The maximum number of characters actually written by vsnprintf() will
| never exceed (len - 1). So,
On Wed, 2 Nov 2016, Christos Zoulas wrote:
In article <20161102003956.35d12f...@cvs.netbsd.org>,
Paul Goyette wrote:
-=-=-=-=-=-
+ /* Handle overflow */
+ if ((size_t)count >= *len) {
+ *dest += *len - 1;
+ *len = 1;
Why *len = 1 here? Shouldn't it be
In article <20161102003956.35d12f...@cvs.netbsd.org>,
Paul Goyette wrote:
>-=-=-=-=-=-
>
>+ /* Handle overflow */
>+ if ((size_t)count >= *len) {
>+ *dest += *len - 1;
>+ *len = 1;
Why *len = 1 here? Shouldn't it be 0 since there is no more room left?
christos