kern/149762: volume labels with rogue characters

Oliver Fromme olli at lurza.secnetix.de
Wed Aug 18 16:36:40 UTC 2010


Walter C. Pelissero wrote:
 >         In the following patch, the function sanitise_name (controlled
 >         by kern.geom.label.sanitation sysctl) replaces characters
 >         deemed invalid according to three levels:
 > 
 >           0 - replace only '/'s with '#'s
 >           1 - like 0, but also replace whitespace and all the ASCII control
 >               characters (anything below 0x20) with '_'
 >           2 - like 1, but also replace anything above 0x7E with '#'
 > 
 >         Note that the replacement of '/'s is done in any case.  I
 >         don't know whether that might be redundant or even bad in the
 >         context of the other geom_label stuff.  It just made sense,
 >         but I don't have enough familiarity with that code.

FWIW, I like this approach much better than the one from
bin/149424.  (Trying to put personal attitudes aside.)

I have reviewed the patch (the second one from the followup),
and it looks good to me, except for a few minor style(9)
issues, and one type problem:  By default, char is unsigned,
so the comparisons p <= ' ' and p > '~' probably don't do
what you expect.

Other than that, the patch looks fine to me.  But I'm not
authoritative regarding the geom code in the kernel, so I
cannot pick this up myself.  I'll re-assign the PR to -geom,
maybe someone there can help.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"... there are two ways of constructing a software design:  One way
is to make it so simple that there are _obviously_ no deficiencies and
the other way is to make it so complicated that there are no _obvious_
deficiencies."        -- C.A.R. Hoare, ACM Turing Award Lecture, 1980


More information about the freebsd-bugs mailing list