1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-04 17:47:26 +03:00

r3585: check sscanf return code

metze
(This used to be commit 9701abfa3a5f6351c8c7bced6adb751be9f5ff31)
This commit is contained in:
Stefan Metzmacher 2004-11-06 21:51:22 +00:00 committed by Gerald (Jerry) Carter
parent e5c8e21129
commit b012ab557b

View File

@ -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;