Bug 21085 - ab - null pointer when parsing incomplete response
Summary: ab - null pointer when parsing incomplete response
Status: CLOSED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Other Modules (show other bugs)
Version: 2.0.46
Hardware: All other
: P3 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-25 15:19 UTC by Glenn Nielsen
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
ab - patch null pointer when parsing a partial response (670 bytes, patch)
2003-06-25 15:21 UTC, Glenn Nielsen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Glenn Nielsen 2003-06-25 15:19:43 UTC
ab can fail due to a null pointer when there is an incomplete response.

A patch will be attached.
Comment 1 Glenn Nielsen 2003-06-25 15:21:27 UTC
Created attachment 6973 [details]
ab - patch null pointer when parsing a partial response
Comment 2 André Malo 2003-06-29 17:54:34 UTC
Fixed in 2.1 and proposed for backport.

I've added another sanity check before committing. The piece of code now looks:

[...]
	    /* check response code */
	    part = strstr(c->cbuff, "HTTP");	/* really HTTP/1.x_ */
            if (part && strlen(part) > strlen("HTTP/1.x_")) {
                strncpy(respcode, (part + strlen("HTTP/1.x_")), 3);
                respcode[3] = '\0';
            }
            else {
                strcpy(respcode, "500");
            }

	    if (respcode[0] != '2') {
[...]

Thanks for your patch!