Browse Source

Merge pull request #534 from athonet-open/fix_tel2sip

siputils: tel2sip(): fix 'off by one' when allocating memory
Daniel-Constantin Mierla 9 years ago
parent
commit
55bf58d81d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      modules/siputils/checks.c

+ 1 - 1
modules/siputils/checks.c

@@ -374,7 +374,7 @@ int tel2sip(struct sip_msg* _msg, char* _uri, char* _hostpart, char* _res)
 
 	/* reserve memory for resulting sip uri */
 	sip_uri.len = 4 + tel_uri.len - 4 + 1 + hostpart.len + 1 + 10;
-	sip_uri.s = pkg_malloc(sip_uri.len);
+	sip_uri.s = pkg_malloc(sip_uri.len+1);
 	if (sip_uri.s == 0) {
 		LM_ERR("no more pkg memory\n");
 		pkg_free(tel_uri.s);