Check for malloc failure in process_chpw_request
authorGreg Hudson <ghudson@mit.edu>
Sun, 2 Mar 2014 23:12:54 +0000 (18:12 -0500)
committerGreg Hudson <ghudson@mit.edu>
Mon, 3 Mar 2014 16:52:40 +0000 (11:52 -0500)
ticket: 7866
target_version: 1.12.2
tags: pullup

src/kadmin/server/schpw.c

index 4a91159e4f6e20fcfe9b3a8a293b5d186b59d29b..900adf7a0997d6138bfce7d6cb5c390558d9dde0 100644 (file)
@@ -311,8 +311,9 @@ process_chpw_request(krb5_context context, void *server_handle, char *realm,
 
 chpwfail:
 
-    clear.length = 2 + strlen(strresult);
-    clear.data = (char *) malloc(clear.length);
+    ret = alloc_data(&clear, 2 + strlen(strresult));
+    if (ret)
+        goto bailout;
 
     ptr = clear.data;