|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * 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 $ |
11 | 11 | *
|
12 | 12 | * NOTES
|
13 | 13 | * This should be moved to a more appropriate place. It is here
|
@@ -257,11 +257,11 @@ lo_import(text *filename)
|
257 | 257 | /*
|
258 | 258 | * open the file to be read in
|
259 | 259 | */
|
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'; |
262 | 262 | fd = open(fnamebuf, O_RDONLY, 0666);
|
263 | 263 | 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", |
265 | 265 | fnamebuf);
|
266 | 266 | }
|
267 | 267 |
|
@@ -325,8 +325,8 @@ lo_export(Oid lobjId, text *filename)
|
325 | 325 | * open the file to be written to
|
326 | 326 | */
|
327 | 327 | 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'; |
330 | 330 | fd = open(fnamebuf, O_CREAT|O_WRONLY, 0666);
|
331 | 331 | (void) umask(oumask);
|
332 | 332 | if (fd < 0) { /* error */
|
|
0 commit comments