1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +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

@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.91 2007/01/26 17:45:41 neilc Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.92 2007/02/08 11:10:27 petere Exp $
*
* NOTES
* [ Most of these notes are wrong/obsolete, but perhaps not all ]
@ -1018,8 +1018,7 @@ SSLerrmessage(void)
errreason = ERR_reason_error_string(errcode);
if (errreason != NULL)
{
strncpy(errbuf, errreason, SSL_ERR_LEN - 1);
errbuf[SSL_ERR_LEN - 1] = '\0';
strlcpy(errbuf, errreason, SSL_ERR_LEN);
return errbuf;
}
snprintf(errbuf, SSL_ERR_LEN, libpq_gettext("SSL error code %lu"), errcode);