فهرست منبع

lcr: remove excessive checks for the 'src_port' accuracy

Remove unneeded check for 'src_port' in:
- ki_from_any_gw_addr()
- ki_from_gw_addr()

Which makes no sense because 'src_port' is of type 'unsigned int',
and the check concerns whether it's less than 0 or not.
Donat Zenichev 4 سال پیش
والد
کامیت
536736f252
1فایلهای تغییر یافته به همراه6 افزوده شده و 6 حذف شده
  1. 6 6
      src/modules/lcr/lcr_mod.c

+ 6 - 6
src/modules/lcr/lcr_mod.c

@@ -3093,9 +3093,9 @@ static int ki_from_gw_addr(
 		return -1;
 	}
 
-	/* src_port set to 0 means we don't want to check it */
-	if((src_port < 0) || (src_port > 65535)) {
-		LM_ERR("invalid port parameter value %d\n", transport);
+	/* src_port set to 0 is allowed and means we don't want to check it */
+	if(src_port > 65535) {
+		LM_ERR("invalid port parameter value %d\n", src_port);
 		return -1;
 	}
 
@@ -3215,9 +3215,9 @@ static int ki_from_any_gw_addr(sip_msg_t *_m, str *addr_str, int transport, unsi
 		return -1;
 	}
 
-	/* src_port set to 0 means we don't want to check it */
-	if((src_port < 0) || (src_port > 65535)) {
-		LM_ERR("invalid port parameter value %d\n", transport);
+	/* src_port set to 0 is allowed and means we don't want to check it */
+	if(src_port > 65535) {
+		LM_ERR("invalid port parameter value %d\n", src_port);
 		return -1;
 	}