From f1255da03c6766d5019817a75bdf2c36afebff25 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Tue, 14 Dec 2021 11:28:10 +1300 Subject: [PATCH] krb5: Check asprintf return value Signed-off-by: Joseph Sutton --- lib/krb5/init_creds_pw.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/krb5/init_creds_pw.c b/lib/krb5/init_creds_pw.c index 792f0ec84..4fd7158f5 100644 --- a/lib/krb5/init_creds_pw.c +++ b/lib/krb5/init_creds_pw.c @@ -430,11 +430,12 @@ krb5_init_creds_warn_user(krb5_context context, "suppress_weak_enctype", NULL); if (!suppress) { char *str = NULL, *p = NULL; + int aret; krb5_enctype_to_string(context, weak_enctype, &str); - (void)asprintf(&p, "Encryption type %s(%d) used for authentication is weak and will be deprecated", - str ? str : "unknown", weak_enctype); - if (p) { + aret = asprintf(&p, "Encryption type %s(%d) used for authentication is weak and will be deprecated", + str ? str : "unknown", weak_enctype); + if (aret >= 0 && p) { (*ctx->prompter)(context, ctx->prompter_data, NULL, p, 0, NULL); free(p); }