[En-Nut-Discussion] Bug Report

Mike Cornelius mikec at call-direct.com.au
Fri Jan 16 06:55:55 CET 2004

Hi All,
I have found a bug in NutNetBufAlloc() netbuf.c
In a number of places there are lines like :-
if (nb->nb_XX.sz < size)
If the condition is true (ie the buffer is too small) the old memory
block is returned to the heap and a new one assigned nb->nb_XX.sz is
updated to reflect the new size and all is OK.
However if the new requested size is smaller than the existing size then
nothing happens.
This is a problem because nb->nb_XX.sz does not get updated to reflect
the new smaller size and sometime later on when the network dirver goes
to send this packet it sends too many bytes.
I've changed the code to if (nb->nb_XX.sz !< size)...
Which works for me but there may be a better way...
Mike Cornelius                      Internet: mikec at call-direct.com.au
Call Direct Cellular Solutions      Phone:    +61 2 9209-4259
Suite 145                           FAX:      +61 2 9209-4196
National Innovation Centre     URL:      http://www.call-direct.com.au
Australian Technology Park
Eveleigh NSW 1430
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20040116/d0e22a6a/attachment.html>

More information about the En-Nut-Discussion mailing list