lkml.org 
[lkml]   [2000]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Modprobe local root exploit
Date
Peter Samuelson wrote:
>
> [Torsten Duwe]
> > >>>>> "Francis" == Francis Galiegue <fg@mandrakesoft.com> writes:
> >
> > >> + if ((*p & 0xdf) >= 'a' && (*p & 0xdf) <= 'z') continue;
> >
> > Francis> Just in case... Some modules have uppercase letters too :)
> >
> > That's what the &0xdf is intended for...
>
> It's wrong, then: you've converted to uppercase, not lowercase.
>
> request_module is not a fast path. Do it the obvious, unoptimized way:
>
> if ((*p < 'a' || *p > 'z') &&
> (*p < 'A' || *p > 'Z') &&
> (*p < '0' || *p > '9') &&
> *p != '-' && *p != '_')
> return -EINVAL;

Heading in the right direction, but this is equivalent to:

if (isalnum(*p) && *p != '-' && *p != '_') return -EINVAL;

which is faster, smaller and easier to read.

--
Daniel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:45    [W:0.105 / U:5.124 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site