mirror of
https://github.com/samba-team/samba.git
synced 2025-03-20 22:50:26 +03:00
heimdal: small code adaption to cherry-pick heimdal commit
Check asprintf() return value. Make use of krb5_enomem(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=11573 Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Alexander Bokovoy <ab@samba.org>
This commit is contained in:
parent
f05a1554b7
commit
88cac23e2b
@ -444,22 +444,17 @@ krb5_config_parse_file_multi (krb5_context context,
|
||||
home = pw->pw_dir;
|
||||
}
|
||||
if (home) {
|
||||
asprintf(&newfname, "%s%s", home, &fname[1]);
|
||||
if (newfname == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM,
|
||||
N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
int aret;
|
||||
|
||||
aret = asprintf(&newfname, "%s%s", home, &fname[1]);
|
||||
if (aret == -1 || newfname == NULL)
|
||||
return krb5_enomem(context);
|
||||
fname = newfname;
|
||||
}
|
||||
#else /* KRB5_USE_PATH_TOKENS */
|
||||
if (asprintf(&newfname, "%%{USERCONFIG}%s", &fname[1]) < 0 ||
|
||||
newfname == NULL)
|
||||
{
|
||||
krb5_set_error_message(context, ENOMEM,
|
||||
N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
return krb5_enomem(context);
|
||||
fname = newfname;
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user