[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Review Request: Fix sanitization of dbus path in KMainWindow
From: Thiago Macieira <thiago () kde ! org>
Date: 2009-08-17 21:45:59
Message-ID: 200908172346.07114.thiago () kde ! org
[Download RAW message or body]
[Attachment #2 (Text/Plain)]
Thomas Lübking wrote:
>Am Monday 17 August 2009 schrieb Matthew Woehlke:
>> If you'd like to "one-up" my patch, please feel free :-). Otherwise
>> I'm not sure what you have in mind.
>
>i guess sth. like
>
>QRegExp identifier("[A-Za-z0-9_]");
>o.objectName().mid(i,1).contains(identifier);
>
>Performance ain't crucial here (and QChar::isLetter() just tests some
> flags), but i just tested and QChar grants ::isLetter to really a lot
> of stuff (esp. as any utf-8 char seems to be split an the first part
> becomes a letter, though it's /no/ [A-Za-z] :-(
>
>(new test code attached)
No need for QRegExp. Just iterate over the string and change the
characters that aren't A-Z, a-z, 0-9 and underscore.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
Qt Developer Days 2009 | Registration Now Open!
Munich, Germany: Oct 12 - 14 San Francisco, California: Nov 2 - 4
http://qt.nokia.com/qtdevdays2009
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic