]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libads: Don’t do first loop iteration if ‘attr’ is NULL
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 28 Sep 2023 03:45:19 +0000 (16:45 +1300)
committerJoseph Sutton <jsutton@samba.org>
Sun, 1 Oct 2023 22:45:38 +0000 (22:45 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/libads/ldap.c

index 3f93b06f984af2d94e263d6bac8b0b47e8c9c5e4..a639cd23dc429537e5c0067c420da3b79eda2a0b 100644 (file)
@@ -3176,6 +3176,10 @@ int ads_count_replies(ADS_STRUCT *ads, void *res)
        for (attr = ldap_first_attribute(ads->ldap.ld, (LDAPMessage *)msg, &ptr);
             attr;
             attr = ldap_next_attribute(ads->ldap.ld, (LDAPMessage *)msg, ptr)) {
+               if (attr == NULL) {
+                       break;
+               }
+
                /* we ignore the fact that this is utf8, as all attributes are ascii... */
                if (strnequal(attr, expected_range_attrib, strlen(expected_range_attrib))) {
                        range_attr = attr;