New submission from
Anthony Tuininga
:
Attached is a patch that fixes the truncation of the property values
returned by msilib.SummaryInfo.GetProperty(). Unfortunately Microsoft
has deemed it necessary to return the size of the string without the
null termination character but insists upon the size including it when
passing it in. Arggh!
----------
components: Library (Lib)
files: _msi.patch2.txt
messages: 55649
nosy: atuining
severity: normal
status: open
title: msilib.SummaryInfo.GetProperty() truncates the string by one character
versions: Python 2.5
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1104>
__________________________________
Index: _msi.c
===================================================================
--- _msi.c (revision 57972)
+++ _msi.c (working copy)
@@ -488,7 +536,7 @@
FILETIME fval;
char sbuf[1000];
char *sval = sbuf;
- DWORD ssize = sizeof(sval);
+ DWORD ssize = sizeof(sbuf);
if (!PyArg_ParseTuple(args, "i:GetProperty", &field))
return NULL;
@@ -496,7 +544,8 @@
status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival,
&fval, sval, &ssize);
if (status == ERROR_MORE_DATA) {
- sval = malloc(ssize);
+ ssize++;
+ sval = malloc(ssize);
status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival,
&fval, sval, &ssize);
}
@@ -508,7 +557,7 @@
PyErr_SetString(PyExc_NotImplementedError, "FILETIME result");
return NULL;
case VT_LPSTR:
- result = PyString_FromStringAndSize(sval, ssize);
+ result = PyString_FromString(sval);
if (sval != sbuf)
free(sval);
return result;
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com