If you delete from fstype on in a disklabel line and have it try to write
it, its internal parsing routines go boom.  I've fixed it locally, and
would like to commit my delta.

%%%
Index: disklabel.c
===================================================================
RCS file: /home/ncvs/src/sbin/disklabel/disklabel.c,v
retrieving revision 1.62
diff -b -d -w -u -r1.62 disklabel.c
--- disklabel.c 8 Oct 2002 12:13:19 -0000       1.62
+++ disklabel.c 27 Oct 2002 01:11:18 -0000
@@ -921,6 +921,9 @@
 {
        char c;
 
+       if (cp == NULL) {
+               return (NULL);
+       }
        while (*cp != '\0' && !isspace(*cp) && *cp != '#')
                cp++;
        if ((c = *cp) != '\0') {
@@ -1233,9 +1236,14 @@
        }
        pp->p_offset = v;
        cp = tp, tp = word(cp);
-       for (cpp = fstypenames; cpp < &fstypenames[FSMAXTYPES]; cpp++)
+       for (cpp = fstypenames; cpp < &fstypenames[FSMAXTYPES]; cpp++) {
+               if (cp == NULL) {
+                       fprintf(stderr, "line %d: invalid entry\n", lineno);
+                       return (1);
+               }
                if (*cpp && streq(*cpp, cp))
                        break;
+       }
        if (*cpp != NULL) {
                pp->p_fstype = cpp - fstypenames;
        } else {
%%%

juli.
-- 
Juli Mallett <[EMAIL PROTECTED]>       | FreeBSD: The Power To Serve
Will break world for fulltime employment. | finger [EMAIL PROTECTED]
http://people.FreeBSD.org/~jmallett/      | Support my FreeBSD hacking!

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to