Author: metze Date: 2004-11-06 21:51:22 +0000 (Sat, 06 Nov 2004) New Revision: 3585
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3585 Log: check sscanf return code metze Modified: branches/SAMBA_4_0/source/libcli/ldap/ldap.c Changeset: Modified: branches/SAMBA_4_0/source/libcli/ldap/ldap.c =================================================================== --- branches/SAMBA_4_0/source/libcli/ldap/ldap.c 2004-11-06 20:43:36 UTC (rev 3584) +++ branches/SAMBA_4_0/source/libcli/ldap/ldap.c 2004-11-06 21:51:22 UTC (rev 3585) @@ -1227,6 +1227,7 @@ 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 @@ /* 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;