krb5: Check asprintf return value

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
This commit is contained in:
Joseph Sutton
2021-12-14 11:28:10 +13:00
committed by Jeffrey Altman
parent b8f8906822
commit f1255da03c

View File

@@ -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);
}