From: Tom Yu Date: Sat, 3 Jan 1998 03:36:38 +0000 (+0000) Subject: * preauth.c (handle_sam_labels): X-Git-Tag: krb5-1.1-beta1~902 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8f5937ef992f98075323157af7ff8b9dda64f793;p=krb5.git * preauth.c (handle_sam_labels): (obtain_sam_padata): Check return of malloc. [krb5-libs/518] * chpw.c (krb5_mk_chpw_req): Check return of malloc. (krb5_rd_chpw_rep): Check return of malloc. [krb5-libs/518] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10346 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index 7e3bfafd6..e9803f199 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -1,3 +1,11 @@ +Fri Jan 2 21:21:29 1998 Tom Yu + + * preauth.c (handle_sam_labels): + (obtain_sam_padata): Check return of malloc. [krb5-libs/518] + + * chpw.c (krb5_mk_chpw_req): Check return of malloc. + (krb5_rd_chpw_rep): Check return of malloc. [krb5-libs/518] + Tue Dec 16 00:08:33 1997 Tom Yu * mk_req_ext.c (krb5_mk_req_extended): Check enctype of session diff --git a/src/lib/krb5/krb/chpw.c b/src/lib/krb5/krb/chpw.c index 3266f4f87..70f1bd82a 100644 --- a/src/lib/krb5/krb/chpw.c +++ b/src/lib/krb5/krb/chpw.c @@ -31,6 +31,8 @@ krb5_mk_chpw_req(context, auth_context, ap_req, passwd, packet) packet->length = 6 + ap_req->length + cipherpw.length; packet->data = (char *) malloc(packet->length); + if (packet->data == NULL) + return ENOMEM; ptr = packet->data; /* length */ @@ -176,6 +178,10 @@ krb5_rd_chpw_rep(context, auth_context, packet, result_code, result_data) if (result_data->length) { result_data->data = (char *) malloc(result_data->length); + if (result_data->data == NULL) { + ret = ENOMEM; + goto cleanup; + } memcpy(result_data->data, ptr, result_data->length); } else { result_data->data = NULL; diff --git a/src/lib/krb5/krb/preauth.c b/src/lib/krb5/krb/preauth.c index 910069d1c..c106dd15a 100644 --- a/src/lib/krb5/krb/preauth.c +++ b/src/lib/krb5/krb/preauth.c @@ -478,6 +478,8 @@ char *handle_sam_labels(sc) p = prompt1 = malloc(label_len + strlen(sep1) + challenge_len + strlen(sep2) + prompt_len+ strlen(sep3) + 1); + if (p == NULL) + return NULL; if (challenge_len) { strncpy(p, label, label_len); p += label_len; strcpy(p, sep1); p += strlen(sep1); @@ -540,7 +542,13 @@ obtain_sam_padata(context, in_padata, etype_info, def_enc_key, /* encrypt passcode in key by stuffing it here */ int pcsize = 256; char *passcode = malloc(pcsize+1); + if (passcode == NULL) + return ENOMEM; prompt = handle_sam_labels(sam_challenge); + if (prompt == NULL) { + free(passcode); + return ENOMEM; + } retval = krb5_read_password(context, prompt, 0, passcode, &pcsize); free(prompt); @@ -552,6 +560,8 @@ obtain_sam_padata(context, in_padata, etype_info, def_enc_key, enc_sam_response_enc.sam_passcode.length = pcsize; } else if (sam_challenge->sam_flags & KRB5_SAM_USE_SAD_AS_KEY) { prompt = handle_sam_labels(sam_challenge); + if (prompt == NULL) + return ENOMEM; retval = sam_get_pass_from_user(context, etype_info, key_proc, key_seed, request, &sam_use_key, prompt);