[ssh.c]
     Use xstrdup/xfree when saving pwname and pwdir; ok deraadt@
This commit is contained in:
Darren Tucker 2007-12-02 23:21:16 +11:00
parent b4fbbc6850
commit e143f062ba
2 changed files with 9 additions and 6 deletions

View File

@ -35,6 +35,9 @@
bz #1377: getpwuid results were being clobbered by another getpw* call
inside tilde_expand_filename(); save the data we need carefully
ok djm
- dtucker@cvs.openbsd.org 2007/11/03 02:00:32
[ssh.c]
Use xstrdup/xfree when saving pwname and pwdir; ok deraadt@
20071030
- (djm) OpenBSD CVS Sync
@ -3452,4 +3455,4 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@
$Id: ChangeLog,v 1.4804 2007/12/02 12:16:32 dtucker Exp $
$Id: ChangeLog,v 1.4805 2007/12/02 12:21:16 dtucker Exp $

10
ssh.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh.c,v 1.306 2007/11/03 01:24:06 deraadt Exp $ */
/* $OpenBSD: ssh.c,v 1.307 2007/11/03 02:00:32 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -1260,8 +1260,8 @@ load_public_identity_files(void)
#endif /* SMARTCARD */
if ((pw = getpwuid(original_real_uid)) == NULL)
fatal("load_public_identity_files: getpwuid failed");
pwname = strdup(pw->pw_name);
pwdir = strdup(pw->pw_dir);
pwname = xstrdup(pw->pw_name);
pwdir = xstrdup(pw->pw_dir);
if (gethostname(thishost, sizeof(thishost)) == -1)
fatal("load_public_identity_files: gethostname: %s",
strerror(errno));
@ -1280,9 +1280,9 @@ load_public_identity_files(void)
options.identity_keys[i] = public;
}
bzero(pwname, strlen(pwname));
free(pwname);
xfree(pwname);
bzero(pwdir, strlen(pwdir));
free(pwdir);
xfree(pwdir);
}
static void