r18024: The %c sscanf format I'm using doesn't null terminate.
authorAndrew Bartlett <abartlet@samba.org>
Mon, 4 Sep 2006 01:59:23 +0000 (01:59 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:17:04 +0000 (14:17 -0500)
Andrew Bartlett
(This used to be commit 1920cb8b3978f745cba7e854410deb9174de2dc0)

source4/libcli/ldap/ldap_client.c

index 4fa8cc01464fe1121f276f5acfc944f4afcc2ab5..bc230879fc956d0d55e671efa7668dc3baaf782d 100644 (file)
@@ -311,9 +311,12 @@ struct composite_context *ldap_connect_send(struct ldap_connection *conn,
                if (!NT_STATUS_IS_OK(status)) {
                        return NULL;
                }
+               talloc_steal(conn, conn->sock);
                SMB_ASSERT(sizeof(protocol)>10);
                SMB_ASSERT(sizeof(path)>1024);
        
+               /* The %c specifier doesn't null terminate :-( */
+               ZERO_STRUCT(path);
                ret = sscanf(url, "%10[^:]://%1025c", protocol, path);
                if (ret < 2) {
                        composite_error(state->ctx, NT_STATUS_INVALID_PARAMETER);