diff --git a/ChangeLog b/ChangeLog index 4b33ac12..b029fb9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-03-01 Federico Di Gregorio + * psycopg/cursor_type.c (psyco_curs_copy_from): we now use + PyOS_snprintf instead of asprintf. On some platforms this can be + bad (win32).. if that's your case, get a better platform. :/ + * psycopg/microprotocols.c (microprotocols_adapt): fixed small typo that made adaptation using __conform__ impossible. diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index 330b6d85..8789b4b8 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -930,7 +930,8 @@ _psyco_curs_has_write_check(PyObject* o, void* var) static PyObject * psyco_curs_copy_from(cursorObject *self, PyObject *args) { - char *table_name, *query = NULL; + char query[256]; + char *table_name; char *sep = "\t", *null ="NULL"; long int bufsize = DEFAULT_COPYSIZE; PyObject *file, *res = NULL; @@ -943,8 +944,8 @@ psyco_curs_copy_from(cursorObject *self, PyObject *args) EXC_IF_CURS_CLOSED(self); - asprintf(&query, "COPY %s FROM stdin USING DELIMITERS '%s'" - " WITH NULL AS '%s'", table_name, sep, null); + PyOS_snprintf(query, 256, "COPY %s FROM stdin USING DELIMITERS '%s'" + " WITH NULL AS '%s'", table_name, sep, null); Dprintf("psyco_curs_copy_from: query = %s", query); self->copysize = bufsize;