Re: Validators accepting null bytes (\x00)

"Brian Beck" <[email protected]>
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
On 4/5/06, Ian Bicking <[email protected]> wrote:
> Maybe there should be a Text validator, that might include an optional
> unicode encoding, and would strip things like \0.  UTF-8 can't include
> \0, I think... but then, maybe the decoded value could include \0, and
> this could remove that.  Without encoding, it would be like String, but
> stripping \0.  String, like Python's str, is currently safe with binary
> data, and I don't think that should change.

True, I hadn't considered the binary data case.  Not sure what to do,
then, if anything.

To SQLite's credit, it raised an exception on one computer I tried
this on when SQLObject gave it the null-containing string.  But on my
home machine (which is more up to date as far as I know) it didn't
seem to mind, resulting in all the data loss.  Both computers running
the same code, but different versions of SQLite.

Anyway, most users aren't aware that this exception is even possible,
meaning their service could crash (which at least is better than data
loss).  So there should definitely be a check for it *somewhere*
before that level.

The bug is fixed in newer versions of Konqueror, but this still shows
that it's at least possible.  A Text validator would do the job...
I'll be checking for this in my strings from now on anyway, might as
well have it somewhere.

--
Brian Beck
Adventurer of the First Order


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.