]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:kdc: Be sure not to pass a NULL pointer into strcmp()
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 5 Sep 2023 02:17:36 +0000 (14:17 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Sep 2023 21:35:29 +0000 (21:35 +0000)
To do so is to invoke undefined behaviour.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/kdc/db-glue.c

index 3821815d0dd2db61c9468f427aea9f515bd08963..c97cfdf47cbade6ab3209b057ff9d8cd22e91a56 100644 (file)
@@ -696,7 +696,9 @@ krb5_error_code samba_kdc_message2entry_keys(krb5_context context,
                }
 
                for (i=0; i < scb.sub.num_packages; i++) {
-                       if (strcmp("Primary:Kerberos-Newer-Keys", scb.sub.packages[i].name) == 0) {
+                       if (scb.sub.packages[i].name != NULL &&
+                           strcmp("Primary:Kerberos-Newer-Keys", scb.sub.packages[i].name) == 0)
+                       {
                                scpk = &scb.sub.packages[i];
                                if (!scpk->data || !scpk->data[0]) {
                                        scpk = NULL;