Explorar o código

uhttpd: fix segmentation fault triggered by invalid header line

SVN-Revision: 22607
Jo-Philipp Wich %!s(int64=15) %!d(string=hai) anos
pai
achega
4847198093
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      package/uhttpd/src/uhttpd.c

+ 2 - 1
package/uhttpd/src/uhttpd.c

@@ -266,7 +266,8 @@ static struct http_request * uh_http_header_parse(struct client *cl, char *buffe
 		}
 
 		/* check version */
-		if( strcmp(version, "HTTP/0.9") && strcmp(version, "HTTP/1.0") && strcmp(version, "HTTP/1.1") )
+		if( (version == NULL) || (strcmp(version, "HTTP/0.9") &&
+		    strcmp(version, "HTTP/1.0") && strcmp(version, "HTTP/1.1")) )
 		{
 			/* unsupported version */
 			uh_http_response(cl, 400, "Bad Request");