seas: check when walking the list
authorDaniel-Constantin Mierla <miconda@gmail.com>
Wed, 14 Apr 2021 10:52:58 +0000 (12:52 +0200)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Thu, 15 Apr 2021 06:35:23 +0000 (08:35 +0200)
(cherry picked from commit 7231be0785009cb17581822f0765985eb7bdb243)

src/modules/seas/seas_action.c

index cd62848..83be630 100644 (file)
@@ -1329,8 +1329,12 @@ int extract_allowed_headers(struct sip_msg *my_msg,int strip_top_vias,int allow_
         }else{
            assert(rtcnt>0);
            rb=hf->parsed;
-           while(--rtcnt)
+           while(rb && --rtcnt)
               rb=rb->next;
+               if(!rb) {
+                       LM_ERR("no rr\n");
+                       goto error;
+               }
            k= (((rb->nameaddr.name.s) + rb->len)-hf->name.s) ;
            if(len+k+CRLF_LEN<headers_len){
               memcpy(headers+len,hf->name.s,k);