Update of /cvsroot/pypgsql/pypgsql
In directory sc8-pr-cvs1:/tmp/cvs-serv26536
Modified Files:
libpqmodule.c
Log Message:
09JUN2003 gh Applied patch from Laurent Pinchart:
In libPQquoteString, bytea are quoted using as much as
5 bytes per input byte (0x00 is quoted '\\000'), so
allocating (slen * 4) + 3 is not enough for data that
contain lots of 0x00 bytes.
Index: libpqmodule.c
===================================================================
RCS file: /cvsroot/pypgsql/pypgsql/libpqmodule.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** libpqmodule.c 1 Dec 2002 04:59:24 -0000 1.26
--- libpqmodule.c 9 Jun 2003 14:56:58 -0000 1.27
***************
*** 32,35 ****
--- 32,40 ----
| Date Ini Description |
| --------- --- ------------------------------------------------------- |
+ | 09JUN2003 gh Applied patch from Laurent Pinchart: |
+ | In libPQquoteString, bytea are quoted using as much as |
+ | 5 bytes per input byte (0x00 is quoted '\\000'), so |
+ | allocating (slen * 4) + 3 is not enough for data that |
+ | contain lots of 0x00 bytes. |
| 28NOV2002 bga Fixed changed PG_TIMESTAMP oid, added PG_TIMESTAMPTZ |
| and PG_REFCURSOR oids. [Bug #845360] |
***************
*** 264,268 ****
/* Calculate the size for the new memory string. */
! i = (slen * (forArray ? 8 : 4)) + 3;
sout = (unsigned char *)PyMem_Malloc(i); /* Assume every char is quoted */
--- 269,273 ----
/* Calculate the size for the new memory string. */
! i = (slen * (forArray ? 8 : 5)) + 3;
sout = (unsigned char *)PyMem_Malloc(i); /* Assume every char is quoted */
|