diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1996-10-16 06:17:57 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1996-10-16 06:17:57 +0000 |
commit | 085935061e167b3fd3dd1b293d15a23f832eec68 (patch) | |
tree | c1a89df427acbd5ee69be717384152c47c29f036 | |
parent | 3938c1d60112eb092f85a0f7d60f0a080fba135c (diff) |
check malloc ret val.
-rw-r--r-- | usr.bin/rlogin/kcmd.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/rlogin/kcmd.c b/usr.bin/rlogin/kcmd.c index 1f61ed74642..2ab8b9729fb 100644 --- a/usr.bin/rlogin/kcmd.c +++ b/usr.bin/rlogin/kcmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kcmd.c,v 1.4 1996/08/18 18:21:24 tholo Exp $ */ +/* $OpenBSD: kcmd.c,v 1.5 1996/10/16 06:17:56 millert Exp $ */ /* $NetBSD: kcmd.c,v 1.2 1995/03/21 07:58:32 cgd Exp $ */ /* @@ -39,7 +39,7 @@ static char Xsccsid[] = "derived from @(#)rcmd.c 5.17 (Berkeley) 6/27/88"; static char sccsid[] = "@(#)kcmd.c 8.2 (Berkeley) 8/19/93"; #else -static char rcsid[] = "$OpenBSD: kcmd.c,v 1.4 1996/08/18 18:21:24 tholo Exp $"; +static char rcsid[] = "$OpenBSD: kcmd.c,v 1.5 1996/10/16 06:17:56 millert Exp $"; #endif #endif /* not lint */ @@ -108,8 +108,10 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, ticket, service, realm, herror(*ahost); return (-1); } - host_save = malloc(strlen(hp->h_name) + 1); - strcpy(host_save, hp->h_name); + if ((host_save = strdup(hp->h_name)) == NULL) { + warn("can't allocate memory"); + return (-1); + } *ahost = host_save; /* If realm is null, look up from table */ |