<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2800.1276" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=043284505-16012004><FONT face=Arial size=2>Hi
All,</FONT></SPAN></DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial size=2>I have found a bug
in NutNetBufAlloc() netbuf.c</FONT></SPAN></DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial size=2>In a number of
places there are lines like :-</FONT></SPAN></DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial size=2>if (nb->nb_XX.sz
< size)</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial size=2>However if the new
requested size is smaller than the existing size then nothing
happens.</FONT></SPAN></DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial size=2>I've changed the
code to <SPAN class=043284505-16012004><FONT face=Arial size=2>if
(nb->nb_XX.sz !< size)...</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial size=2><SPAN
class=043284505-16012004></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial size=2><SPAN
class=043284505-16012004>Which works for me but there may be a better
way...</SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial size=2><SPAN
class=043284505-16012004></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=043284505-16012004><FONT face=Arial size=2><SPAN
class=043284505-16012004></SPAN></FONT></SPAN> </DIV>
<DIV align=left><FONT face=Arial
size=2>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR>Mike
Cornelius
Internet: <A
href="mailto:mikec@call-direct.com.au">mikec@call-direct.com.au</A><BR>Call
Direct Cellular Solutions Phone:
+61 2 9209-4259<BR>Suite
145
FAX: +61 2 9209-4196<BR>National Innovation
Centre URL: <A
href="http://www.call-direct.com.au/">http://www.call-direct.com.au</A><BR>Australian
Technology Park<BR>Eveleigh NSW
1430<BR>Australia
<BR>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</FONT></DIV>
<DIV> </DIV></BODY></HTML>