fstabscan() fixes:
- if _fs_fstab.fs_type is NULL, the line is incorrect, so warn about it rather than trying to deference a NULL pointer. fixes [bin/13787] by Dave Burgess. - clear _fs_fstab before each use (just to be sure)
This commit is contained in:
parent
ba96ebc2fd
commit
9839c99d92
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fstab.c,v 1.22 2000/01/22 22:19:10 mycroft Exp $ */
|
||||
/* $NetBSD: fstab.c,v 1.23 2001/08/31 00:31:07 lukem 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.23 2001/08/31 00:31:07 lukem 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;
|
||||
@ -160,6 +161,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)
|
||||
|
Loading…
Reference in New Issue
Block a user