Skip to content

Commit fc70db0

Browse files
authored
Merge pull request #7 from ActiveState/jeremyp/cve-3177
cve-2120-3177 fix type declarations for Visual C++
2 parents 23b4a15 + 21f322e commit fc70db0

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Modules/_ctypes/callproc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,9 @@ PyCArg_dealloc(PyCArgObject *self)
460460
static PyObject *
461461
PyCArg_repr(PyCArgObject *self)
462462
{
463+
PyObject *f;
464+
PyObject *r;
465+
char *value;
463466
switch(self->tag) {
464467
case 'b':
465468
case 'B':
@@ -477,25 +480,22 @@ PyCArg_repr(PyCArgObject *self)
477480
case 'L':
478481
return PyString_FromFormat("<cparam '%c' (%ld)>",
479482
self->tag, self->value.l);
480-
481-
#ifdef HAVE_LONG_LONG
482483
case 'q':
483484
case 'Q':
484-
return PyString_FromFormat("<cparam '%c' (%" PY_FORMAT_LONG_LONG "d)>",
485+
return PyString_FromFormat("<cparam '%c' (%lld)>",
485486
self->tag, self->value.q);
486-
#endif
487487
case 'd':
488488
case 'f': {
489-
PyObject *f = PyFloat_FromDouble((self->tag == 'f') ? self->value.f : self->value.d);
489+
f = PyFloat_FromDouble((self->tag == 'f') ? self->value.f : self->value.d);
490490
if (f == NULL) {
491491
return NULL;
492492
}
493-
PyObject *r = PyObject_Repr(f);
493+
r = PyObject_Repr(f);
494494
Py_DECREF(f);
495495
if (r == NULL) {
496496
return NULL;
497497
}
498-
char *value = PyString_AsString(r);
498+
value = PyString_AsString(r);
499499
Py_DECREF(r);
500500
if (value == NULL) {
501501
return NULL;

0 commit comments

Comments
 (0)