Explorar o código

dialog: more checks for dlg_set_timeout() params

- related to GH #1011
Daniel-Constantin Mierla %!s(int64=8) %!d(string=hai) anos
pai
achega
618888cc94
Modificáronse 1 ficheiros con 9 adicións e 1 borrados
  1. 9 1
      src/modules/dialog/dialog.c

+ 9 - 1
src/modules/dialog/dialog.c

@@ -1133,8 +1133,16 @@ static int w_dlg_set_timeout(struct sip_msg *msg, char *pto, char *phe, char *ph
 		LM_ERR("no timeout value\n");
 		return -1;
 	}
+	if(to<=0) {
+		LM_ERR("invalid timeout value: %d\n", to);
+		return -1;
+	}
 	if(phe!=NULL)
 	{
+		if(phi==NULL) {
+			LM_ERR("invalid number of parameters\n");
+			return -1;
+		}
 		if(fixup_get_ivalue(msg, (gparam_p)phe, (int*)&he)!=0)
 		{
 			LM_ERR("no hash entry value value\n");
@@ -1156,7 +1164,7 @@ static int w_dlg_set_timeout(struct sip_msg *msg, char *pto, char *phe, char *ph
 		return -1;
 	}
 
-	if(update_dlg_timeout(dlg, to) != 0) 
+	if(update_dlg_timeout(dlg, to) != 0)
 		return -1;
 
 	return 1;