[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
src/usr.sbin/ppp/pppctl/pppctl.c getpass() NULL check
- To: bugs_(_at_)_openbsd_(_dot_)_org
- Subject: src/usr.sbin/ppp/pppctl/pppctl.c getpass() NULL check
- From: Jared Yanovich <jjy2+_(_at_)_pitt_(_dot_)_edu>
- Date: Wed, 12 Nov 2003 23:14:56 -0500
getpass(3) says getpass() can return NULL under unfortunate
circumstances.
- Jared
Index: pppctl.c
===================================================================
RCS file: /cvs/src/usr.sbin/ppp/pppctl/pppctl.c,v
retrieving revision 1.15
diff -u -r1.15 pppctl.c
--- pppctl.c 31 Oct 2003 08:48:16 -0000 1.15
+++ pppctl.c 13 Nov 2003 04:14:18 -0000
@@ -120,11 +120,12 @@
for (last = Buffer+len-2; last > Buffer && *last != ' '; last--)
;
if (last > Buffer+3 && !strncmp(last-3, " on", 3)) {
- /* a password is required ! */
+ /* a password is required! */
if (display & REC_PASSWD) {
/* password time */
if (!passwd)
- passwd = getpass("Password: ");
+ if ((passwd = getpass("Password: ")) == NULL)
+ err(1, "getpass");
snprintf(Buffer, sizeof Buffer, "passwd %s\n", passwd);
memset(passwd, '\0', strlen(passwd));
if (display & REC_VERBOSE)
Visit your host, monkey.org