This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

redboot http client fix


Hello

if the HTTP response header is not immediately followed by the file contents
(read in the same buffer by redboot) so the CRLF CRLF ending is the last thing
in the buffer, those 4 bytes are skipped and are instead read as the file
sinature instead of .ELF.
So the check should be extended to work even if there are exactly 4 bytes.
It does not appear with 'normal' webservers, however I used a script to talk
to redboot and it triggered this behaviour many times.

I'll commit if it's approved.

Jani
--- orig/packages/redboot/current/src/net/http_client.c
+++ mod/packages/redboot/current/src/net/http_client.c
@@ -188,7 +188,7 @@
                             return -1;
                         }
                         // Find \r\n\r\n - end of HTTP preamble
-                        while (s->avail > 4) {
+                        while (s->avail >= 4) {
                             // This could be done faster, but not simpler
                             if (strncmp(s->bufp, "\r\n\r\n", 4) == 0) {
                                 s->bufp += 4;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]