Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libc/gen/fstab.c,v retrieving revision 1.22 retrieving revision 1.22.6.2 diff -u -p -r1.22 -r1.22.6.2 --- src/lib/libc/gen/fstab.c 2000/01/22 22:19:10 1.22 +++ src/lib/libc/gen/fstab.c 2002/04/25 04:01:41 1.22.6.2 @@ -1,4 +1,4 @@ -/* $NetBSD: fstab.c,v 1.22 2000/01/22 22:19:10 mycroft Exp $ */ +/* $NetBSD: fstab.c,v 1.22.6.2 2002/04/25 04:01:41 nathanw Exp $ */ /* * Copyright (c) 1980, 1988, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)fstab.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: fstab.c,v 1.22 2000/01/22 22:19:10 mycroft Exp $"); +__RCSID("$NetBSD: fstab.c,v 1.22.6.2 2002/04/25 04:01:41 nathanw Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -101,6 +101,7 @@ fstabscan() FSTAB_RW, FSTAB_RQ, FSTAB_RO, FSTAB_SW, FSTAB_DP, FSTAB_XX, NULL }; + (void)memset(&_fs_fstab, 0, sizeof(_fs_fstab)); for (;;) { if (!(lp = fgets(line, sizeof(line), _fs_fp))) return 0; @@ -145,7 +146,11 @@ fstabscan() if ((cp = nextfld(&lp, ws)) != NULL) _fs_fstab.fs_passno = atoi(cp); } - sp = strncpy(subline, _fs_fstab.fs_mntops, sizeof(subline)-1); + + /* subline truncated iff line truncated */ + (void)strlcpy(subline, _fs_fstab.fs_mntops, sizeof(subline)); + sp = subline; + while ((cp = nextfld(&sp, ",")) != NULL) { char **tp; @@ -160,6 +165,8 @@ fstabscan() if (*tp) break; } + if (_fs_fstab.fs_type == NULL) + goto bad; if (strcmp(_fs_fstab.fs_type, FSTAB_XX) == 0) continue; if (cp != NULL)