Commit 3e873022 authored by Bruce Momjian's avatar Bruce Momjian

libpq's pqGetnchar() should not return a null-terminated value

anymore.  Fix for large objects.
parent b9b00d5f
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.62 1998/08/17 03:50:35 scrappy Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.63 1998/08/29 02:09:24 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -612,6 +612,7 @@ getAnotherTuple(PGconn *conn, int binary) ...@@ -612,6 +612,7 @@ getAnotherTuple(PGconn *conn, int binary)
if (vlen > 0) if (vlen > 0)
if (pqGetnchar((char *) (tup[i].value), vlen, conn)) if (pqGetnchar((char *) (tup[i].value), vlen, conn))
return EOF; return EOF;
/* we have to terminate this ourselves */
tup[i].value[vlen] = '\0'; tup[i].value[vlen] = '\0';
} }
/* advance the bitmap stuff */ /* advance the bitmap stuff */
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.18 1998/08/17 03:50:38 scrappy Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.19 1998/08/29 02:09:25 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -160,8 +160,7 @@ pqPuts(const char *s, PGconn *conn) ...@@ -160,8 +160,7 @@ pqPuts(const char *s, PGconn *conn)
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* pqGetnchar: /* pqGetnchar:
get a string of exactly len bytes in buffer s (which must be 1 byte get a string of exactly len bytes in buffer s, no null termination
longer) and terminate it with a '\0'.
*/ */
int int
pqGetnchar(char *s, int len, PGconn *conn) pqGetnchar(char *s, int len, PGconn *conn)
...@@ -170,7 +169,7 @@ pqGetnchar(char *s, int len, PGconn *conn) ...@@ -170,7 +169,7 @@ pqGetnchar(char *s, int len, PGconn *conn)
return EOF; return EOF;
memcpy(s, conn->inBuffer + conn->inCursor, len); memcpy(s, conn->inBuffer + conn->inCursor, len);
s[len] = '\0'; /* no terminating null */
conn->inCursor += len; conn->inCursor += len;
......
...@@ -11,3 +11,5 @@ update include/version.h after release ...@@ -11,3 +11,5 @@ update include/version.h after release
update backend/parser/scan.c and gram.c so flex/bison not necessary update backend/parser/scan.c and gram.c so flex/bison not necessary
update pgaccess update pgaccess
update odbc update odbc
update doc/src/sgml/release.sgml
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment