summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2005-12-19 17:07:44 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2005-12-19 17:07:44 +0000
commitd4d0ab9cb01a98494afc8e6f8ffa66b6dc7914a9 (patch)
treee3eab8bfd8f42118040c7a5d02c0588803253c0a
parentac2c0c874e7b11e15575c4d8f792df68159b320b (diff)
Use strlcpy() return value in bound check instead of using an
extra strlen(). This has been in my tree for a long time.
-rw-r--r--lib/libc/gen/authenticate.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/libc/gen/authenticate.c b/lib/libc/gen/authenticate.c
index e78754889a5..a4f7aea2bd8 100644
--- a/lib/libc/gen/authenticate.c
+++ b/lib/libc/gen/authenticate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authenticate.c,v 1.14 2005/06/26 16:39:14 millert Exp $ */
+/* $OpenBSD: authenticate.c,v 1.15 2005/12/19 17:07:43 millert Exp $ */
/*-
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
@@ -301,9 +301,8 @@ auth_usercheck(char *name, char *style, char *type, char *password)
struct passwd *pwd;
char *sep, save;
- if (strlen(name) >= sizeof(namebuf))
+ if (strlcpy(namebuf, name, sizeof(namebuf)) >= sizeof(namebuf))
return (NULL);
- strlcpy(namebuf, name, sizeof namebuf);
name = namebuf;
/*