1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Normalize fgets() calls to use sizeof() for calculating the buffer size

where possible, and fix some sites that apparently thought that fgets()
will overwrite the buffer by one byte.

Also add some strlcpy() to eliminate some weird memory handling.
This commit is contained in:
Peter Eisentraut
2007-02-08 11:10:27 +00:00
parent b79575ce45
commit 086c189456
10 changed files with 38 additions and 41 deletions

View File

@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.73 2007/02/05 15:22:18 adunstan Exp $
* $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.74 2007/02/08 11:10:27 petere Exp $
*/
#include "postgres_fe.h"
#include "copy.h"
@ -801,7 +801,7 @@ handleCopyIn(PGconn *conn, FILE *copystream, bool isbinary)
/* enable longjmp while waiting for input */
sigint_interrupt_enabled = true;
fgresult = fgets(buf, COPYBUFSIZ, copystream);
fgresult = fgets(buf, sizeof(buf), copystream);
sigint_interrupt_enabled = false;