krb5 commit [krb5-1.11]: Check for malloc failure in process_chpw_request

Tom Yu tlyu at mit.edu
Fri Feb 6 17:26:49 EST 2015


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

    Check for malloc failure in process_chpw_request
    
    (cherry picked from commit 4356deefa2d2fe0bc7b52f3b62a387c7ec1eb369)
    
    ticket: 8086 (new)
    version_fixed: 1.11.6
    status: resolved

 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 b4ff1a4..7c8e517 100644
--- a/src/kadmin/server/schpw.c
+++ b/src/kadmin/server/schpw.c
@@ -314,8 +314,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