This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
redboot http client fix
- From: Jani Monoses <jani at iv dot ro>
- To: ecos-patches at ecos dot sourceware dot org
- Date: Fri, 13 Aug 2004 15:13:15 +0300
- Subject: 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;