]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:kdc: Initialize entry->modified_by
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 10 Aug 2023 02:37:34 +0000 (14:37 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 14 Aug 2023 04:57:34 +0000 (04:57 +0000)
If smb_krb5_make_principal() fails without setting the principal,
sdb_entry_free() will try to free whatever memory the uninitialized
member points to.

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

index 55885e3724740aa455d6dceeb9ed3e9c5c378a97..f3ecfd54b70088ec8e6cabc66807d93568ff9c66 100644 (file)
@@ -1237,10 +1237,10 @@ static krb5_error_code samba_kdc_message2entry(krb5_context context,
                        goto out;
                }
 
-               entry->modified_by = (struct sdb_event *) malloc(sizeof(struct sdb_event));
+               entry->modified_by = calloc(1, sizeof(struct sdb_event));
                if (entry->modified_by == NULL) {
                        ret = ENOMEM;
-                       krb5_set_error_message(context, ret, "malloc: out of memory");
+                       krb5_set_error_message(context, ret, "calloc: out of memory");
                        goto out;
                }