Browse code

pv: check parameters and fix log message for invalid values for {s.fmtline...}

Daniel-Constantin Mierla authored on 05/05/2022 09:38:41
Showing 1 changed files
... ...
@@ -1476,14 +1476,14 @@ int tr_eval_string(struct sip_msg *msg, tr_param_t *tp, int subtype,
1476 1476
 				if(pv_get_spec_value(msg, (pv_spec_p)tp->next->v.data, &v)!=0
1477 1477
 						|| (!(v.flags&PV_VAL_INT)))
1478 1478
 				{
1479
-					LM_ERR("fmt cannot get p2 (cfg line: %d)\n",
1479
+					LM_ERR("fmtline cannot get p2 (cfg line: %d)\n",
1480 1480
 							get_cfg_crt_line());
1481 1481
 					return -1;
1482 1482
 				}
1483 1483
 				m = v.ri;
1484 1484
 			}
1485
-			if(n<0 || m<0) {
1486
-				LM_ERR("substr negative offset (cfg line: %d)\n",
1485
+			if(n<=0 || m<0) {
1486
+				LM_ERR("fmtline with invalid parameters (cfg line: %d)\n",
1487 1487
 						get_cfg_crt_line());
1488 1488
 				return -1;
1489 1489
 			}