diff stream/network.c @ 30909:0d0f53c47bd8

Make http_read_response fail if parsing the response failed. Avoids possible crashes since other code assumes http_hdr->protocol is a valid string if it succeeds.
author reimar
date Tue, 23 Mar 2010 19:45:33 +0000
parents eede6479d924
children d739cbeb0e38
line wrap: on
line diff
--- a/stream/network.c	Tue Mar 23 19:40:37 2010 +0000
+++ b/stream/network.c	Tue Mar 23 19:45:33 2010 +0000
@@ -299,7 +299,10 @@
 		}
 		http_response_append( http_hdr, response, i );
 	} while( !http_is_header_entire( http_hdr ) );
-	http_response_parse( http_hdr );
+	if (http_response_parse( http_hdr ) < 0) {
+		http_free( http_hdr );
+		return NULL;
+	}
 	return http_hdr;
 }