lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #28519] lwip_recvfrom bug with len > 65535


From: Stephane Lesage
Subject: [lwip-devel] [bug #28519] lwip_recvfrom bug with len > 65535
Date: Fri, 08 Jan 2010 07:01:21 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

URL:
  <http://savannah.nongnu.org/bugs/?28519>

                 Summary: lwip_recvfrom bug with len > 65535
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: slesage
            Submitted on: ven 08 jan 2010 08:01:20 CET
                Category: sockets
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: CVS Head

    _______________________________________________________

Details:

Hi,
 
I had a non-reproductible problem with my http server while reading of big
POST.
Sometimes read() would return 0 = connection closed for no reason.
On a simplified version of a firmware I've recently made, it was systematic.
 
So I enabled LWIP debugging, but I had no warning/severe error.
Then I enabled all SOCKETS_DEBUG messages, and I got the attached output.
 
The reason I get 0 from read() is actually very simple.
I call read() with a very big malloc()ed buffer because I know the content
length from the POST headers.
 
read() parameter len is size_t, but the variable off in lwip_recvfrom() is
only u16_t.
Guess what happens when we accumulate data in the buffer and update the
variable off...
 
modifications to lwip_recvfrom() in sockets.c:
- declare off as size_t
- change format specifiers to SZT_F for debug output
 
Now it works correctly.
 



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: ven 08 jan 2010 08:01:20 CET  Name: lwipdebugout.txt  Size: 20 ko   By:
slesage

<http://savannah.nongnu.org/bugs/download.php?file_id=19437>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?28519>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]