* svr_principal.c (kadm5_get_principal): Do not assume malloc(0)
authorEzra Peisach <epeisach@mit.edu>
Fri, 4 Oct 1996 12:41:52 +0000 (12:41 +0000)
committerEzra Peisach <epeisach@mit.edu>
Fri, 4 Oct 1996 12:41:52 +0000 (12:41 +0000)
returns non-NULL. [krb5-admin/46]

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9143 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/kadm5/srv/ChangeLog
src/lib/kadm5/srv/svr_principal.c

index dd9f678b821bd5b41718c9c0c273f416c9e618fe..50923c17770584f2735d63f2bc54cb05a1904c27 100644 (file)
@@ -1,3 +1,8 @@
+Fri Oct  4 08:40:21 1996  Ezra Peisach  <epeisach@kangaroo.mit.edu>
+
+       * svr_principal.c (kadm5_get_principal): Do not assume malloc(0)
+               returns non-NULL. [krb5-admin/46]
+
 Fri Aug  2 14:07:31 1996  Barry Jaspan  <bjaspan@DUN-DUN-NOODLES>
 
        * svr_principal.c: remove krb5_free_keyblock_contents (moved to
index 082f98c0b0f2e31d00fef716c6ea04a577ff1478..5bb1cbbbb909d08d564b58296162845efccd7986 100644 (file)
@@ -738,12 +738,16 @@ kadm5_get_principal(void *server_handle, krb5_principal principal,
         }
         if (mask & KADM5_KEY_DATA) {
              entry->n_key_data = kdb.n_key_data;
-             entry->key_data = (krb5_key_data *)
-                  malloc(entry->n_key_data*sizeof(krb5_key_data));
-             if (entry->key_data == NULL) {
-                  ret = ENOMEM;
-                  goto done;
-             }
+             if(entry->n_key_data) {
+                     entry->key_data = (krb5_key_data *)
+                             malloc(entry->n_key_data*sizeof(krb5_key_data));
+                     if (entry->key_data == NULL) {
+                             ret = ENOMEM;
+                             goto done;
+                     }
+             } else 
+                     entry->key_data = NULL;
+
              for (i = 0; i < entry->n_key_data; i++)
                   if (ret = krb5_copy_key_data_contents(handle->context,
                                                         &kdb.key_data[i],