Browse code

sip: b/f: return immediately from parse_headers() if the input string is empty

Raphael Coeffic authored on 10/12/2013 09:39:12
Showing 1 changed files
... ...
@@ -284,9 +284,13 @@ int parse_headers(list<sip_header*>& hdrs, char** c, char* end)
284 284
     int saved_st = 0;
285 285
 
286 286
     char* begin = *c;
287
+    if(!(*c) || (*c == end)) {
288
+	return 0;
289
+    }
290
+
287 291
     auto_ptr<sip_header> hdr(new sip_header());
288 292
 
289
-    for(;**c && (*c < end);(*c)++){
293
+    for(;(*c < end) && **c;(*c)++){
290 294
 
291 295
 	switch(st){
292 296