Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fb5be86

Browse files
committed
LO patches for loimport/loexport from Raymond Toy
1 parent f416150 commit fb5be86

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/backend/libpq/be-fsstubs.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.9 1997/05/06 07:16:21 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.10 1997/06/10 13:01:32 momjian Exp $
1111
*
1212
* NOTES
1313
* This should be moved to a more appropriate place. It is here
@@ -257,11 +257,11 @@ lo_import(text *filename)
257257
/*
258258
* open the file to be read in
259259
*/
260-
strncpy(fnamebuf, VARDATA(filename), VARSIZE(filename));
261-
fnamebuf[VARSIZE(filename)] = '\0';
260+
strncpy(fnamebuf, VARDATA(filename), VARSIZE(filename) - VARHDRSZ);
261+
fnamebuf[VARSIZE(filename) - VARHDRSZ] = '\0';
262262
fd = open(fnamebuf, O_RDONLY, 0666);
263263
if (fd < 0) { /* error */
264-
elog(WARN, "lo_import: can't open unix file\"%s\"\n",
264+
elog(WARN, "be_lo_import: can't open unix file\"%s\"\n",
265265
fnamebuf);
266266
}
267267

@@ -325,8 +325,8 @@ lo_export(Oid lobjId, text *filename)
325325
* open the file to be written to
326326
*/
327327
oumask = umask((mode_t) 0);
328-
strncpy(fnamebuf, VARDATA(filename), VARSIZE(filename));
329-
fnamebuf[VARSIZE(filename)] = '\0';
328+
strncpy(fnamebuf, VARDATA(filename), VARSIZE(filename) - VARHDRSZ);
329+
fnamebuf[VARSIZE(filename) - VARHDRSZ] = '\0';
330330
fd = open(fnamebuf, O_CREAT|O_WRONLY, 0666);
331331
(void) umask(oumask);
332332
if (fd < 0) { /* error */

0 commit comments

Comments
 (0)