[sr-dev] git:master: siputils: fix for e164_check()

Daniel-Constantin Mierla miconda at gmail.com
Wed Dec 10 16:22:43 CET 2014


Module: sip-router
Branch: master
Commit: fbcfa198a2c89868fa021f6a63774425e480b27b
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fbcfa198a2c89868fa021f6a63774425e480b27b

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Wed Dec 10 16:14:16 2014 +0100

siputils: fix for e164_check()

- the condition for non-digit matching was always false

---

 modules/siputils/checks.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/modules/siputils/checks.c b/modules/siputils/checks.c
index fab644d..3ee096f 100644
--- a/modules/siputils/checks.c
+++ b/modules/siputils/checks.c
@@ -420,17 +420,17 @@ int tel2sip(struct sip_msg* _msg, char* _uri, char* _hostpart, char* _res)
  */
 static inline int e164_check(str* _user)
 {
-    int i;
-    char c;
-    
-    if ((_user->len > 2) && (_user->len < 17) && ((_user->s)[0] == '+')) {
-	for (i = 1; i <= _user->len; i++) {
-	    c = (_user->s)[i];
-	    if (c < '0' && c > '9') return -1;
+	int i;
+	char c;
+
+	if ((_user->len > 2) && (_user->len < 17) && ((_user->s)[0] == '+')) {
+		for (i = 1; i <= _user->len; i++) {
+			c = (_user->s)[i];
+			if (c < '0' || c > '9') return -1;
+		}
+		return 1;
 	}
-	return 1;
-    }
-    return -1;
+	return -1;
 }
 
 




More information about the sr-dev mailing list