2
0
Эх сурвалжийг харах

app_lua: safety check of returned anchor before using it

Daniel-Constantin Mierla 8 жил өмнө
parent
commit
f109109a19

+ 6 - 0
modules/app_lua/app_lua_sr.c

@@ -744,6 +744,12 @@ static int lua_sr_hdr_append (lua_State *L)
 	memcpy(hdr, txt, len);
 	anchor = anchor_lump(env_L->msg,
 				hf->name.s + hf->len - env_L->msg->buf, 0, 0);
+	if(anchor==NULL)
+	{
+		LM_ERR("unable to get the anchor\n");
+		pkg_free(hdr);
+		return 0;
+	}
 	if(insert_new_lump_before(anchor, hdr, len, 0) == 0)
 	{
 		LM_ERR("can't insert lump\n");