summaryrefslogtreecommitdiff
path: root/source4/libcli/ldap
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-11-06 21:51:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:35 -0500
commitb012ab557b8f8a2f58dfbbe8b7818f3e6d8cf38f (patch)
tree2a09615488e563a0feed511f0ea98f96ea11518e /source4/libcli/ldap
parente5c8e21129a2144633b518979f9a66eb8953dae6 (diff)
downloadsamba-b012ab557b8f8a2f58dfbbe8b7818f3e6d8cf38f.tar.gz
samba-b012ab557b8f8a2f58dfbbe8b7818f3e6d8cf38f.tar.bz2
samba-b012ab557b8f8a2f58dfbbe8b7818f3e6d8cf38f.zip
r3585: check sscanf return code
metze (This used to be commit 9701abfa3a5f6351c8c7bced6adb751be9f5ff31)
Diffstat (limited to 'source4/libcli/ldap')
-rw-r--r--source4/libcli/ldap/ldap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c
index 2eea7b035a..dd689027f9 100644
--- a/source4/libcli/ldap/ldap.c
+++ b/source4/libcli/ldap/ldap.c
@@ -1227,6 +1227,7 @@ BOOL ldap_parse_basic_url(TALLOC_CTX *mem_ctx, const char *url,
char protocol[11];
char tmp_host[255];
const char *p = url;
+ int ret;
/* skip leading "URL:" (if any) */
if (strncasecmp( p, "URL:", 4) == 0) {
@@ -1236,7 +1237,10 @@ BOOL ldap_parse_basic_url(TALLOC_CTX *mem_ctx, const char *url,
/* Paranoia check */
SMB_ASSERT(sizeof(protocol)>10 && sizeof(tmp_host)>254);
- sscanf(p, "%10[^:]://%254[^:/]:%d", protocol, tmp_host, &tmp_port);
+ ret = sscanf(p, "%10[^:]://%254[^:/]:%d", protocol, tmp_host, &tmp_port);
+ if (ret < 2) {
+ return False;
+ }
if (strequal(protocol, "ldap")) {
*port = 389;