summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrian <brian@openbsd.org>1999-06-08 20:12:23 +0000
committerbrian <brian@openbsd.org>1999-06-08 20:12:23 +0000
commit7a3dbedff877a0d3a2c5ded5708531be7fd78b5c (patch)
treeab7187de3acc388cc4810527cc3266d5eff8842d
parentSome large partition fixes (diff)
downloadwireguard-openbsd-7a3dbedff877a0d3a2c5ded5708531be7fd78b5c.tar.xz
wireguard-openbsd-7a3dbedff877a0d3a2c5ded5708531be7fd78b5c.zip
Don't drop the last character from lines in ppp.secret unless it's '\n'.
-rw-r--r--usr.sbin/ppp/ppp/auth.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/ppp/ppp/auth.c b/usr.sbin/ppp/ppp/auth.c
index e108e7821ca..ff08d8f8864 100644
--- a/usr.sbin/ppp/ppp/auth.c
+++ b/usr.sbin/ppp/ppp/auth.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: auth.c,v 1.11 1999/05/08 11:06:33 brian Exp $
+ * $Id: auth.c,v 1.12 1999/06/08 20:12:23 brian Exp $
*
* TODO:
* o Implement check against with registered IP addresses.
@@ -247,7 +247,7 @@ auth_GetSecret(struct bundle *bundle, const char *name, int len,
FILE *fp;
int n;
char *vector[5];
- static char buff[LINE_LEN];
+ static char buff[LINE_LEN]; /* vector[] will point here when returned */
fp = OpenSecret(SECRETFILE);
if (fp == NULL)
@@ -256,7 +256,9 @@ auth_GetSecret(struct bundle *bundle, const char *name, int len,
while (fgets(buff, sizeof buff, fp)) {
if (buff[0] == '#')
continue;
- buff[strlen(buff) - 1] = 0;
+ n = strlen(buff) - 1;
+ if (buff[n] == '\n')
+ buff[n] = '\0'; /* Trim the '\n' */
memset(vector, '\0', sizeof vector);
n = MakeArgs(buff, vector, VECSIZE(vector));
if (n < 2)