Eryk Sun <[email protected]> added the comment:
There's still a potential problem when Reg2Py calls wcslen(str[index]). This
could be addressed by having fixupMultiSZ take an int array to store the length
of each string. For example:
static void
fixupMultiSZ(wchar_t **strings, int *lengths, wchar_t *data, int len)
{
wchar_t *P, *Q = data + len;
int i;
for (P = data, i = 0; P < Q && *P; P++, i++) {
strings[i] = P;
lengths[i] = 0;
for (; P < Q && *P; P++) {
lengths[i]++;
}
}
}
We'd have to allocate the lengths array in Reg2Py, like we do for the strings
array. Also, we can remove the overflow error check prior to
PyUnicode_FromWideChar. The longest possible length is `retDataSize / 2`, which
occurs if a single string is stored without any null terminators.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue9194>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com