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

Commit7ee7ee1

Browse files
committed
BLOBs containing NUL characters (ASCII 0) can be written to the
database, but they get truncated at the first NUL by lo_readwhen they are read back. The reason for this is that lo_read inPg.xs is using the default: OUTPUT: RETVAL bufwhich uses C's strlen() to work out the length of the scalar.The code ought to read something more like: OUTPUT: RETVAL buf sv_setpvn((SV*)ST(2), buf, RETVAL);I am not sure if this needs to be done on both lo_read methodsin this file, but I changed both and have not since had anyproblems with truncated BLOBs.Douglas Thomson <dougt@mugc.cc.monash.edu.au>
1 parent714efa8 commit7ee7ee1

File tree

1 file changed

+3
-3
lines changed
  • src/interfaces/perl5

1 file changed

+3
-3
lines changed

‎src/interfaces/perl5/Pg.xs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*-------------------------------------------------------
22
*
3-
* $Id: Pg.xs,v 1.12 1999/02/19 23:27:17 tgl Exp $
3+
* $Id: Pg.xs,v 1.13 1999/10/13 02:26:37 momjian Exp $ with patch for NULs
44
*
55
* Copyright (c) 1997, 1998 Edmund Mergl
66
*
@@ -643,7 +643,7 @@ lo_read(conn, fd, buf, len)
643643
}
644644
OUTPUT:
645645
RETVAL
646-
buf
646+
bufsv_setpvn((SV*)ST(2),buf,RETVAL);/* to handle NULs */
647647

648648
int
649649
lo_write(conn,fd,buf,len)
@@ -1029,7 +1029,7 @@ lo_read(conn, fd, buf, len)
10291029
}
10301030
OUTPUT:
10311031
RETVAL
1032-
buf
1032+
bufsv_setpvn((SV*)ST(2),buf,RETVAL);/* to handle NULs */
10331033

10341034

10351035
int

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp