Selaa lähdekoodia

textops: safety check to know there is a string to add via lump

Daniel-Constantin Mierla 10 vuotta sitten
vanhempi
commit
ca220afe0f
1 muutettua tiedostoa jossa 5 lisäystä ja 0 poistoa
  1. 5 0
      modules/textops/textops.c

+ 5 - 0
modules/textops/textops.c

@@ -2111,6 +2111,11 @@ int add_hf_helper(struct sip_msg* msg, str *str1, str *str2,
 	len=s0.len;
 	if (str2) len+= str2->len + REQ_LINE(msg).uri.len;
 
+	if(len==0) {
+		LM_INFO("nothing to add\n");
+		return -1;
+	}
+
 	s  = (char*)pkg_malloc(len);
 	if (!s) {
 		LM_ERR("no pkg memory left\n");