Browse code

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

(cherry picked from commit ca220afe0f738f2353d16c96dd16ab279ffdcf74)

Daniel-Constantin Mierla authored on 14/05/2015 12:29:12
Showing 1 changed files
... ...
@@ -2126,6 +2126,11 @@ int add_hf_helper(struct sip_msg* msg, str *str1, str *str2,
2126 2126
 	len=s0.len;
2127 2127
 	if (str2) len+= str2->len + REQ_LINE(msg).uri.len;
2128 2128
 
2129
+	if(len==0) {
2130
+		LM_INFO("nothing to add\n");
2131
+		return -1;
2132
+	}
2133
+
2129 2134
 	s  = (char*)pkg_malloc(len);
2130 2135
 	if (!s) {
2131 2136
 		LM_ERR("no pkg memory left\n");