Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3e87302

Browse files
committed
libpq's pqGetnchar() should not return a null-terminated value
anymore. Fix for large objects.
1 parentb9b00d5 commit3e87302

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

‎src/interfaces/libpq/fe-exec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.62 1998/08/17 03:50:35 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.63 1998/08/29 02:09:24 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -612,6 +612,7 @@ getAnotherTuple(PGconn *conn, int binary)
612612
if (vlen>0)
613613
if (pqGetnchar((char*) (tup[i].value),vlen,conn))
614614
returnEOF;
615+
/* we have to terminate this ourselves */
615616
tup[i].value[vlen]='\0';
616617
}
617618
/* advance the bitmap stuff */

‎src/interfaces/libpq/fe-misc.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*
2525
*
2626
* IDENTIFICATION
27-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.18 1998/08/17 03:50:38 scrappy Exp $
27+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.19 1998/08/29 02:09:25 momjian Exp $
2828
*
2929
*-------------------------------------------------------------------------
3030
*/
@@ -160,8 +160,7 @@ pqPuts(const char *s, PGconn *conn)
160160

161161
/* --------------------------------------------------------------------- */
162162
/* pqGetnchar:
163-
get a string of exactly len bytes in buffer s (which must be 1 byte
164-
longer) and terminate it with a '\0'.
163+
get a string of exactly len bytes in buffer s, no null termination
165164
*/
166165
int
167166
pqGetnchar(char*s,intlen,PGconn*conn)
@@ -170,8 +169,8 @@ pqGetnchar(char *s, int len, PGconn *conn)
170169
returnEOF;
171170

172171
memcpy(s,conn->inBuffer+conn->inCursor,len);
173-
s[len]='\0';
174-
172+
/* no terminating null */
173+
175174
conn->inCursor+=len;
176175

177176
if (conn->Pfdebug)

‎src/tools/RELEASE_CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ update include/version.h after release
1111
update backend/parser/scan.c and gram.c so flex/bison not necessary
1212
update pgaccess
1313
update odbc
14+
update doc/src/sgml/release.sgml
15+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp