GVariant: fix string validation
authorRyan Lortie <desrt@desrt.ca>
Mon, 9 Jul 2012 16:43:50 +0000 (12:43 -0400)
committerRyan Lortie <desrt@desrt.ca>
Mon, 9 Jul 2012 16:47:31 +0000 (12:47 -0400)
commit5a85fe0e37504cea13fe8a587691f72373b18830
tree4aa8a6df2e891cd6b38309f10ba877bdbec35f8c
parent3b0f1cc432b546c538d82036bd1a655489d11f35
GVariant: fix string validation

String validation was done by checking if the string was valid utf8 and
ensuring that the first non-utf8 character was the last character (ie:
the nul terminator).

No check was actually done to make sure that this byte actually
contained a nul, however, so it was possible that you could have a
string like "hello\xff" with length 6 that would correctly validate.

Fix that, and test it.
glib/gvariant-serialiser.c
glib/tests/gvariant.c