diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-09-12 20:47:40 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-09-12 20:47:40 +0000 |
commit | 349ac2b94d82782ff2bde9acec8928ce203a01ac (patch) | |
tree | 9b6fc4a496c7c91ff09063b7b12d5c1ed9b1aec9 /lib/libskey | |
parent | cb173c591d6843273d3d33c786974e2d6c459e90 (diff) |
Don't let strncpy() get a negative length. Noted by Theo.
Diffstat (limited to 'lib/libskey')
-rw-r--r-- | lib/libskey/skeylogin.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libskey/skeylogin.c b/lib/libskey/skeylogin.c index a99a25072dc..d4c90681f83 100644 --- a/lib/libskey/skeylogin.c +++ b/lib/libskey/skeylogin.c @@ -11,7 +11,7 @@ * * S/KEY verification check, lookups, and authentication. * - * $OpenBSD: skeylogin.c,v 1.21 1997/09/04 18:19:47 millert Exp $ + * $OpenBSD: skeylogin.c,v 1.22 1997/09/12 20:47:39 millert Exp $ */ #include <sys/param.h> @@ -439,7 +439,7 @@ skey_authenticate(username) for (p = pbuf; *p && isalnum(*p); p++) if (isalpha(*p) && isupper(*p)) *p = tolower(*p); - if (*p) + if (*p && pbuf - p < 4) (void)strncpy(p, "asjd", 4 - (pbuf - p)); p = &pbuf[4]; *p = '\0'; |