Re: buffer overflow detected in bcrelay
Christoph Biedl <[email protected]> Thu, 16 Oct 2014 01:50:17 +0200
| Newsgroups | gmane.network.poptop |
|---|---|
| Message-ID | <[email protected]> |
Charlie Brady wrote... > On Wed, Oct 15, 2014 at 7:18 PM, Christoph Biedl > <[email protected]> wrote: > > Dropping logstr_cntr and doing "logstr += strlen (logstr);" should do > > the right thing. > > Doesn't that depend on snprintf having sufficient space for the > terminating null? Hm? If snprintf has one or more bytes available, it can and will write the terminating null. If you provide size 0, snprintf appears to be a no-op. So in the given use case, appending to a text buffer, the only bad idea is to provide 0 in the very first snprintf call. This does not happen in bcrelay.c. Christoph -- ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho