From d31da416a6ddee3fce0eaf390491c9fb1e633f57 Mon Sep 17 00:00:00 2001 From: Ray Lai Date: Wed, 26 Sep 2007 02:50:37 +0000 Subject: From Tamas TEVESZ: - Use strcspn to strip \r and \n. OK chl. --- libexec/identd/parse.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libexec/identd/parse.c b/libexec/identd/parse.c index 6947ef830fe..dd4c3e11a8a 100644 --- a/libexec/identd/parse.c +++ b/libexec/identd/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.44 2007/03/21 03:32:28 tedu Exp $ */ +/* $OpenBSD: parse.c,v 1.45 2007/09/26 02:50:36 ray Exp $ */ /* * This program is in the public domain and may be used freely by anyone @@ -62,7 +62,7 @@ check_noident(char *homedir) int getuserident(char *homedir, char *buf, int len) { - char path[MAXPATHLEN], *p; + char path[MAXPATHLEN]; int fd, nread, n; struct stat st; @@ -87,8 +87,7 @@ getuserident(char *homedir, char *buf, int len) buf[nread] = '\0'; /* remove illegal characters */ - if ((p = strpbrk(buf, "\r\n"))) - *p = '\0'; + buf[strcspn(buf, "\r\n")] = '\0'; close(fd); return 1; -- cgit v1.2.3