Browse code

seas: check when walking the list

Daniel-Constantin Mierla authored on 14/04/2021 10:52:58
Showing 1 changed files
... ...
@@ -1329,8 +1329,12 @@ int extract_allowed_headers(struct sip_msg *my_msg,int strip_top_vias,int allow_
1329 1329
 	 }else{
1330 1330
 	    assert(rtcnt>0);
1331 1331
 	    rb=hf->parsed;
1332
-	    while(--rtcnt)
1332
+	    while(rb && --rtcnt)
1333 1333
 	       rb=rb->next;
1334
+		if(!rb) {
1335
+			LM_ERR("no rr\n");
1336
+			goto error;
1337
+		}
1334 1338
 	    k= (((rb->nameaddr.name.s) + rb->len)-hf->name.s) ;
1335 1339
 	    if(len+k+CRLF_LEN<headers_len){
1336 1340
 	       memcpy(headers+len,hf->name.s,k);