search for: this_message_size

Displaying 2 results from an estimated 2 matches for "this_message_size".

2008 Feb 12
4
[PATCH] skeleton.c
...6, and a > block of 6 bytes is callocated. > Then snprintf is called with a byte limit of message_size+1 (7, one more > than the allocated size), with the string "X: X\r\n", 6 characters and a > terminating NULL. 7 bytes will be written, overwrite. yup, you're right. The (this_message_size+1) argument to snprintf, after only allocating (this_message_size) chars, was asking for trouble. However if we simply truncate to the correct length then the final LF is replaced with NUL by snprintf. So we need to allocate room for one extra char (the NUL) as you have done, but then not truncate...
2008 Feb 01
2
[PATCH] skeleton.c
On 01/02/2008, Conrad Parker <conrad@metadecks.org> wrote: > On 31/01/2008, ogg.k.ogg.k@googlemail.com <ogg.k.ogg.k@googlemail.com> wrote: > > This fixes an off by one bug in the user of snprintf, and returns > > negative if writing the > > header returns negative (otherwise we'd just get a short write, losing > > the error). > > This patch