From 13f7b30bebfeac8de71e91e20ea5429e80da1e4b Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 25 Jun 2002 17:42:30 +0000 Subject: Now that we don't have a trailing newline we need to explicitly check that the first char in the line is not NUL after killing comments. --- lib/libutil/login_fbtab.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/libutil') diff --git a/lib/libutil/login_fbtab.c b/lib/libutil/login_fbtab.c index 40703267a7c..6bc5a854a75 100644 --- a/lib/libutil/login_fbtab.c +++ b/lib/libutil/login_fbtab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: login_fbtab.c,v 1.10 2002/06/22 00:18:58 millert Exp $ */ +/* $OpenBSD: login_fbtab.c,v 1.11 2002/06/25 17:42:29 millert Exp $ */ /************************************************************************ * Copyright 1995 by Wietse Venema. All rights reserved. Some individual @@ -103,8 +103,9 @@ login_fbtab(const char *tty, uid_t uid, gid_t gid) buf = tbuf; } if ((cp = strchr(buf, '#'))) - *cp = 0; /* strip comment */ - if ((cp = devname = strtok_r(buf, WSPACE, &toklast)) == NULL) + *cp = '\0'; /* strip comment */ + if (buf[0] == '\0' || + (cp = devname = strtok_r(buf, WSPACE, &toklast)) == NULL) continue; /* empty or comment */ if (strncmp(devname, _PATH_DEV, sizeof(_PATH_DEV) - 1) != 0 || (cp = strtok_r(NULL, WSPACE, &toklast)) == NULL || -- cgit v1.2.3