Hi,
When I try to save a string containing NUL character (\x00), only the
part before the character is saved. I have created a simple model:

class Test(models.Model):
   content = models.TextField()

And this happens:

>>> from mysite.test.models import Test
>>> test = Test(content="blabla\x00blablabla")
>>> test.content
'blabla\x00blablabla'
>>> test.save()
>>> test.pk
1
>>> Test.objects.get(pk=1).content
u'blabla'
>>> test.content
'blabla\x00blablabla'

The end of the string is simply lost, no errors are raised, nothing.
Since python supports NUL character in strings, Django should support
them too, or at least raise an error, or just drop it, but not losing
all the end of the string. Also, it is possible to send a NUL
character through GET or POST, so I think this bug could lead to a SQL
Injection.
This happens on Django 0.96.1 and SVN, using SQLite database.

Alexandre Martani
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to