aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_config_ldap.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-10 19:20:57 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-10 19:20:57 +0000
commitd1ec1aa57d296243d584ad268d8e61d7d1998569 (patch)
tree2596a6cb913ad8bd78e4670d298dc1d4682b2d23 /res/res_config_ldap.c
parent4548c33d84f71a04a0416a26b9f0dea0ae061cc4 (diff)
AST-2009-005
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@211539 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_config_ldap.c')
-rw-r--r--res/res_config_ldap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index e0cb5946b..aabd18a60 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -1597,7 +1597,7 @@ int parse_config(void)
if ((s = ast_variable_retrieve(config, "_general", "url"))) {
ast_copy_string(url, s, sizeof(url));
} else if ((host = ast_variable_retrieve(config, "_general", "host"))) {
- if (!(s = ast_variable_retrieve(config, "_general", "port")) || sscanf(s, "%d", &port) != 1) {
+ if (!(s = ast_variable_retrieve(config, "_general", "port")) || sscanf(s, "%5d", &port) != 1 || port > 65535) {
ast_log(LOG_NOTICE, "No directory port found, using 389 as default.\n");
port = 389;
}
@@ -1618,7 +1618,7 @@ int parse_config(void)
if (!(s = ast_variable_retrieve(config, "_general", "version")) && !(s = ast_variable_retrieve(config, "_general", "protocol"))) {
ast_log(LOG_NOTICE, "No explicit LDAP version found, using 3 as default.\n");
version = 3;
- } else if (sscanf(s, "%d", &version) != 1 || version < 1 || version > 6) {
+ } else if (sscanf(s, "%30d", &version) != 1 || version < 1 || version > 6) {
ast_log(LOG_WARNING, "Invalid LDAP version '%s', using 3 as default.\n", s);
version = 3;
}