]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/ldap: Don’t try to encode NULL name
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 6 Jul 2023 22:37:09 +0000 (10:37 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 8 Aug 2023 04:39:37 +0000 (04:39 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
libcli/ldap/ldap_message.c

index c7d868449630a0e7da6748ef9064a3d2701b9df2..3099086b05bfb5727449e6c643ad0ba0541eb69e 100644 (file)
@@ -546,6 +546,9 @@ _PUBLIC_ bool ldap_encode(struct ldap_message *msg,
                for (i=0; i<r->num_attributes; i++) {
                        struct ldb_message_element *attrib = &r->attributes[i];
                        if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) goto err;
+                       if (attrib->name == NULL) {
+                               goto err;
+                       }
                        if (!asn1_write_OctetString(data, attrib->name,
                                               strlen(attrib->name))) goto err;
                        if (!asn1_push_tag(data, ASN1_SET)) goto err;