Don't die of SIGSEGV on a missing fstype field

in a saved disklabel file.

MFC after:	1 week
This commit is contained in:
Yaroslav Tykhiy 2003-04-01 14:44:53 +00:00
parent 51a5b7f1ba
commit 29f3f095a6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112945
2 changed files with 8 additions and 0 deletions

View File

@ -1134,6 +1134,10 @@ getasciipartspec(char *tp, struct disklabel *lp, int part, int lineno)
return (1);
}
pp->p_offset = v;
if (tp == NULL) {
fprintf(stderr, "line %d: missing file system type\n", lineno);
return (1);
}
cp = tp, tp = word(cp);
for (cpp = fstypenames; cpp < &fstypenames[FSMAXTYPES]; cpp++)
if (*cpp && streq(*cpp, cp))

View File

@ -1134,6 +1134,10 @@ getasciipartspec(char *tp, struct disklabel *lp, int part, int lineno)
return (1);
}
pp->p_offset = v;
if (tp == NULL) {
fprintf(stderr, "line %d: missing file system type\n", lineno);
return (1);
}
cp = tp, tp = word(cp);
for (cpp = fstypenames; cpp < &fstypenames[FSMAXTYPES]; cpp++)
if (*cpp && streq(*cpp, cp))