Re: CVS commit: src/sys/dev/pci

2016-11-01 Thread Christos Zoulas
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

Re: CVS commit: src/sys/dev/pci

2016-11-01 Thread Paul Goyette
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

Re: CVS commit: src/sys/dev/pci

2016-11-01 Thread Christos Zoulas
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,

Re: CVS commit: src/sys/dev/pci

2016-11-01 Thread Paul Goyette
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

Re: CVS commit: src/sys/dev/pci

2016-11-01 Thread Christos Zoulas
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