summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-11-13 00:27:57 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-11-13 00:27:57 +0000
commit2b4b9d2b5fd0896a719a50e28eaf097ab70c7ceb (patch)
treeb71f0ee4b0af28ba11dbc6c5378eae2aa1607363
parente56076793ef5fa4d3b6b83fb1fea1d2dae61a20f (diff)
handle asprintf() failure; from dhill@mindcry.org
-rw-r--r--libexec/login_krb5/login_krb5.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libexec/login_krb5/login_krb5.c b/libexec/login_krb5/login_krb5.c
index dcd30139bc6..571e4da722b 100644
--- a/libexec/login_krb5/login_krb5.c
+++ b/libexec/login_krb5/login_krb5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: login_krb5.c,v 1.22 2005/11/12 13:28:00 deraadt Exp $ */
+/* $OpenBSD: login_krb5.c,v 1.23 2005/11/13 00:27:56 deraadt Exp $ */
/*-
* Copyright (c) 2001, 2002 Hans Insulander <hin@openbsd.org>.
@@ -173,7 +173,11 @@ krb5_login(char *username, char *invokinguser, char *password, int login,
if (strcmp(username, "root") == 0 && invokinguser[0] != '\0') {
char *tmp;
- asprintf(&tmp, "%s/root", invokinguser);
+ ret = asprintf(&tmp, "%s/root", invokinguser);
+ if (ret == -1) {
+ krb5_syslog(context, LOG_ERR, ret, "asprintf");
+ exit(1);
+ }
ret = krb5_parse_name(context, tmp, &princ);
free(tmp);
} else