This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: Extracting strings from Python beyond the terminating NULL
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: Project Archer <archer at sourceware dot org>
- Date: Tue, 12 May 2009 10:17:58 +0100
- Subject: Re: Extracting strings from Python beyond the terminating NULL
- References: <4A092DDE.4020801@redhat.com>
Phil Muldoon wrote:
And the code in question uses that. So even though we dutifully
preserve the embedded null, when the call to Python is made to extract
the string, it is terminated on the first null. I'm hoping I missed a
length based api call that some python hacker can point me too.
PyString_Size(string) actually returns the correct (non null
terminated) length btw.
And it only took me to write this email to to figure out that:
PyString_AsStringAndSize(object, &result, &size);
Will fetch the whole string, and report the size as well.
(In the existing code the xstrdup call threw me)
Thanks for reading anyway!
Regards
Phil