changeset 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 fbb65a2153c6
children dd0c440f3205
files stream/network.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
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;
 }