mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
dumpfs blindly trusts that it has been handed a filesystem.
If the magic is bad, don't waste our time. Submitted by: Giles Lean Giles Lean <giles@nemeton.com.au> Obtained from: NetBSD PR bin/249
This commit is contained in:
parent
04eaedf23d
commit
c650708207
1 changed files with 7 additions and 0 deletions
|
|
@ -115,6 +115,13 @@ dumpfs(name)
|
|||
if (read(fd, &afs, SBSIZE) != SBSIZE)
|
||||
goto err;
|
||||
|
||||
if (afs.fs_magic != FS_MAGIC) {
|
||||
warnx("%s: superblock has bad magic number, skipping.",
|
||||
name);
|
||||
(void) close(fd);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (afs.fs_postblformat == FS_42POSTBLFMT)
|
||||
afs.fs_nrpos = 8;
|
||||
dev_bsize = afs.fs_fsize / fsbtodb(&afs, 1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue