Module: kamailio
Branch: master
Commit: fed93eed03b84298544b91a5227ad752f38d56e3
URL:
https://github.com/kamailio/kamailio/commit/fed93eed03b84298544b91a5227ad75…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-05-03T23:02:38+02:00
Merge pull request #594 from boettner/master
a single digit is a valid enum_query() request
---
Modified: modules/enum/enum.c
---
Diff:
https://github.com/kamailio/kamailio/commit/fed93eed03b84298544b91a5227ad75…
Patch:
https://github.com/kamailio/kamailio/commit/fed93eed03b84298544b91a5227ad75…
---
diff --git a/modules/enum/enum.c b/modules/enum/enum.c
index 6439f54..1abd962 100644
--- a/modules/enum/enum.c
+++ b/modules/enum/enum.c
@@ -254,7 +254,7 @@ static inline int is_e164(str* _user)
int i;
char c;
- if ((_user->len > 2) && (_user->len < MAX_NUM_LEN) &&
((_user->s)[0] == '+')) {
+ if ((_user->len > 1) && (_user->len < MAX_NUM_LEN) &&
((_user->s)[0] == '+')) {
for (i = 1; i < _user->len; i++) {
c = (_user->s)[i];
if ((c < '0') || (c > '9')) return -1;
@@ -762,14 +762,15 @@ int enum_query(struct sip_msg* _msg, str* suffix, str* service)
return -1;
}
+ user_s = _msg->parsed_uri.user.s;
+ user_len = _msg->parsed_uri.user.len;
+
if (is_e164(&(_msg->parsed_uri.user)) == -1) {
- LM_ERR("R-URI user is not an E164 number\n");
+ LM_ERR("R-URI user '<%.*s>' is not an E164 number\n",
+ user_len, user_s);
return -1;
}
- user_s = _msg->parsed_uri.user.s;
- user_len = _msg->parsed_uri.user.len;
-
memcpy(&(string[0]), user_s, user_len);
string[user_len] = (char)0;