disklabel coredumps in the case you don't specify FS type

Antonio Huete Jimenez ahuete.devel at gmail.com
Tue Nov 25 11:27:08 PST 2008


Hi,

Seems that disklabel coredumps in the case you don't specify FS type on 
a line when editing.

 g:    1048576   14942208    4.2BSD    #     512.000MB
 h:   12288000   15990784    4.2BSD    #    6000.000MB
i:      *       *
~
/tmp/EdDk.AtVvnxo30B: 30 lines, 806 characters.
Segmentation fault (core dumped)
Patch below fixes this issue:

Index: disklabel.c
===================================================================
RCS file: /home/dcvs/src/sbin/disklabel/disklabel.c,v
retrieving revision 1.27.2.1
diff -u -r1.27.2.1 disklabel.c
--- disklabel.c 16 Sep 2008 21:54:32 -0000      1.27.2.1
+++ disklabel.c 25 Nov 2008 19:25:13 -0000
@@ -1166,6 +1166,12 @@
       /*
        * fstype
        */
+       if (tp == NULL) {
+               fprintf(stderr,
+                       "line %d: %s: no filesystem type was 
specified\n" , lineno, cp);
+               return(1);
+       }
+
       cp = tp;
       tp = word(cp);
       for (cpp = fstypenames; cpp < &fstypenames[FSMAXTYPES]; cpp++)






More information about the Submit mailing list