[Python-checkins] CVS: python/dist/src/Objects weakrefobject.c,1.5,1.6
Barry Warsaw
bwarsaw@users.sourceforge.net
2001年11月28日 13:01:58 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv16128
Modified Files:
weakrefobject.c
Log Message:
weakref_repr(), proxy_repr(): Conversion of sprintf() to
PyOS_snprintf() for buffer overrun avoidance.
Index: weakrefobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/weakrefobject.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** weakrefobject.c 2001年11月28日 11:46:59 1.5
--- weakrefobject.c 2001年11月28日 21:01:56 1.6
***************
*** 132,142 ****
char buffer[256];
if (PyWeakref_GET_OBJECT(self) == Py_None) {
! sprintf(buffer, "<weakref at %lx; dead>",
! (long)(self));
}
else {
! sprintf(buffer, "<weakref at %#lx; to '%.50s' at %#lx>",
! (long)(self), PyWeakref_GET_OBJECT(self)->ob_type->tp_name,
! (long)(PyWeakref_GET_OBJECT(self)));
}
return PyString_FromString(buffer);
--- 132,144 ----
char buffer[256];
if (PyWeakref_GET_OBJECT(self) == Py_None) {
! PyOS_snprintf(buffer, sizeof(buffer), "<weakref at %lx; dead>",
! (long)(self));
}
else {
! PyOS_snprintf(buffer, sizeof(buffer),
! "<weakref at %#lx; to '%.50s' at %#lx>",
! (long)(self),
! PyWeakref_GET_OBJECT(self)->ob_type->tp_name,
! (long)(PyWeakref_GET_OBJECT(self)));
}
return PyString_FromString(buffer);
***************
*** 266,272 ****
{
char buf[160];
! sprintf(buf, "<weakref at %p to %.100s at %p>", proxy,
! PyWeakref_GET_OBJECT(proxy)->ob_type->tp_name,
! PyWeakref_GET_OBJECT(proxy));
return PyString_FromString(buf);
}
--- 268,275 ----
{
char buf[160];
! PyOS_snprintf(buf, sizeof(buf),
! "<weakref at %p to %.100s at %p>", proxy,
! PyWeakref_GET_OBJECT(proxy)->ob_type->tp_name,
! PyWeakref_GET_OBJECT(proxy));
return PyString_FromString(buf);
}