mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-15 08:20:16 +08:00
Several calls to StrNCpy incorrectly subtracted 1 from the length arg,
leading to postmaster accepting args 1 shorter than it had room for.
This commit is contained in:
parent
6a02746550
commit
58422dd0af
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.24 2000/01/26 05:56:29 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.25 2000/03/19 22:10:07 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -197,7 +197,7 @@ PacketSendError(Packet *pkt, char *errormsg)
|
|||||||
fprintf(stderr, "%s\n", errormsg);
|
fprintf(stderr, "%s\n", errormsg);
|
||||||
|
|
||||||
pkt->pkt.em.data[0] = 'E';
|
pkt->pkt.em.data[0] = 'E';
|
||||||
StrNCpy(&pkt->pkt.em.data[1], errormsg, sizeof(pkt->pkt.em.data) - 2);
|
StrNCpy(&pkt->pkt.em.data[1], errormsg, sizeof(pkt->pkt.em.data) - 1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The NULL i/o callback will cause the connection to be broken when
|
* The NULL i/o callback will cause the connection to be broken when
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.137 2000/03/17 02:36:18 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.138 2000/03/19 22:10:08 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -1146,15 +1146,15 @@ readStartupPacket(void *arg, PacketLen len, void *pkt)
|
|||||||
* silently added and a long packet is silently truncated.
|
* silently added and a long packet is silently truncated.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
StrNCpy(port->database, si->database, sizeof(port->database) - 1);
|
StrNCpy(port->database, si->database, sizeof(port->database));
|
||||||
StrNCpy(port->user, si->user, sizeof(port->user) - 1);
|
StrNCpy(port->user, si->user, sizeof(port->user));
|
||||||
StrNCpy(port->options, si->options, sizeof(port->options) - 1);
|
StrNCpy(port->options, si->options, sizeof(port->options));
|
||||||
StrNCpy(port->tty, si->tty, sizeof(port->tty) - 1);
|
StrNCpy(port->tty, si->tty, sizeof(port->tty));
|
||||||
|
|
||||||
/* The database defaults to the user name. */
|
/* The database defaults to the user name. */
|
||||||
|
|
||||||
if (port->database[0] == '\0')
|
if (port->database[0] == '\0')
|
||||||
StrNCpy(port->database, si->user, sizeof(port->database) - 1);
|
StrNCpy(port->database, si->user, sizeof(port->database));
|
||||||
|
|
||||||
/* Check a user name was given. */
|
/* Check a user name was given. */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user