Re: [PATCH] kernel: escape non-ASCII and control characters inprintk()

From: Vasiliy Kulikov
Date: Wed Jun 22 2011 - 13:48:26 EST


On Wed, Jun 22, 2011 at 10:14 -0700, Joe Perches wrote:
> On Wed, 2011-06-22 at 20:53 +0400, Vasiliy Kulikov wrote:
> > On Wed, Jun 22, 2011 at 09:38 -0700, Joe Perches wrote:
> > > > + if ((c >= ' ' && c < 127) || c == '\n')
> > > if (isprint(c))
> > #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
> > It slightly differs from what I've written. It (1) lacks '\n',
>
> You still need tab,

Correct.

> so:
>
> if (isprint(c) || isspace(c))

No, it also allows vertical tabs. Looking into __ctype only ' ', '\n' and
'\t' should be allowed among all _S, so

if (isprint(c) || (c == '\n') || (c == '\t'))


Thanks,

--
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/