Date: Mon, 15 Mar 2010 21:49:15 +0100 From: Ivan Voras <ivoras@freebsd.org> To: freebsd-geom@freebsd.org Subject: Re: Escape unsafe characters for kern.geom.confxml XML dump Message-ID: <hnm6gb$qr7$1@dough.gmane.org> In-Reply-To: <20100313083551.GB966@a91-153-117-195.elisa-laajakaista.fi> References: <20100313083551.GB966@a91-153-117-195.elisa-laajakaista.fi>
next in thread | previous in thread | raw e-mail | index | archive | help
Jaakko Heinonen wrote:
> Hi,
>
> I intend to commit following patch unless there are objections. I have
> seen the problem commonly reported by FreeBSD users.
>
> ---
>
> Escape characters unsafe for XML output in GEOM class, instance and provider
> names.
Go for it!
> + for (c = str; *c != '\0'; c++) {
> + if (*c == '&' || *c == '<' || *c == '>' ||
> + *c == '\'' || *c == '"' || *c > 0x7e)
> + sbuf_printf(s, "&#x%X;", *c);
> + else if (*c == '\t' || *c == '\n' || *c == '\r' || *c > 0x1f)
> + sbuf_putc(s, *c);
> + else
> + sbuf_putc(s, '?');
Wouldn't it be slightly better (it's not important, really), to use HTML
"entities" instead - & > < ' " ? The only benefit
(which is why it isn't important) is that it would make it more
human-readable.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?hnm6gb$qr7$1>
