http_parse patch

Thomas Wiesel <[email protected]>
Newsgroups gmane.comp.web.polipo.user
Organization http://freemail.web.de/
Message-ID <[email protected]>
Hi,

i have attached a small patch for checking content length converting overflow.
polipo now responds with a 

502 Couldn't parse server headers

when objects exceed 2GB+ 

Thomas

hunk ./http_parse.c 901
                 do_log(L_WARN, ".\n");
                 len = -1;
             } else {
+		errno = 0;
                 len = strtol(buf + value_start, &endptr, 10);
hunk ./http_parse.c 903
+		if(errno == ERANGE) {
+                    do_log(L_ERROR, "Content-Length overflow: \n");
+                    do_log_n(L_ERROR, buf + value_start, [_$_]
+                             value_end - value_start);
+                    do_log(L_ERROR, ".\n");
+                    goto fail;
+                }
                 if(endptr <= buf + value_start) {
                     do_log(L_WARN, "Couldn't parse Content-Length: \n");
                     do_log_n(L_WARN, buf + value_start, [_$_]



___________________________________________________________________
WEB.DE FreeDSL Komplettanschluss mit DSL 6.000 Flatrate und 
Telefonanschluss für 17,95 Euro/mtl.! http://produkte.web.de/go/02/


------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.