krb5 commit: Check for malloc failure in process_chpw_request

Greg Hudson ghudson at MIT.EDU
Mon Mar 3 11:58:09 EST 2014


https://github.com/krb5/krb5/commit/4356deefa2d2fe0bc7b52f3b62a387c7ec1eb369
commit 4356deefa2d2fe0bc7b52f3b62a387c7ec1eb369
Author: Greg Hudson <ghudson at mit.edu>
Date:   Sun Mar 2 18:12:54 2014 -0500

    Check for malloc failure in process_chpw_request
    
    ticket: 7866
    target_version: 1.12.2
    tags: pullup

 src/kadmin/server/schpw.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/kadmin/server/schpw.c b/src/kadmin/server/schpw.c
index 4a91159..900adf7 100644
--- a/src/kadmin/server/schpw.c
+++ b/src/kadmin/server/schpw.c
@@ -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;
 


More information about the cvs-krb5 mailing list