mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Use strncpy() and local buffers instead of snprintf(), since not everyone
has snprintf().
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.16 1996/10/24 07:55:07 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.17 1996/10/28 09:05:29 bryanh Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@@ -598,20 +598,23 @@ ConnStartup(Port *port, int *status,
|
|||||||
(void) strncpy(namebuf, sp.user, NAMEDATALEN);
|
(void) strncpy(namebuf, sp.user, NAMEDATALEN);
|
||||||
namebuf[NAMEDATALEN] = '\0';
|
namebuf[NAMEDATALEN] = '\0';
|
||||||
if (!namebuf[0]) {
|
if (!namebuf[0]) {
|
||||||
snprintf(errormsg, errormsg_len,
|
strncpy(errormsg,
|
||||||
"No Postgres username specified in startup packet.");
|
"No Postgres username specified in startup packet.",
|
||||||
|
errormsg_len);
|
||||||
*status = STATUS_ERROR;
|
*status = STATUS_ERROR;
|
||||||
} else {
|
} else {
|
||||||
if (be_recvauth(msgType, port, namebuf, &sp) != STATUS_OK) {
|
if (be_recvauth(msgType, port, namebuf, &sp) != STATUS_OK) {
|
||||||
snprintf(errormsg, errormsg_len,
|
char buffer[200 + sizeof(namebuf)];
|
||||||
|
sprintf(buffer,
|
||||||
"Failed to authenticate client as Postgres user '%s' "
|
"Failed to authenticate client as Postgres user '%s' "
|
||||||
"using authentication scheme %d.",
|
"using authentication scheme %d.",
|
||||||
namebuf, msgType);
|
namebuf, msgType);
|
||||||
|
strncpy(errormsg, buffer, errormsg_len);
|
||||||
*status = STATUS_ERROR;
|
*status = STATUS_ERROR;
|
||||||
} else {
|
} else {
|
||||||
if (BackendStartup(&sp, port, &pid) != STATUS_OK) {
|
if (BackendStartup(&sp, port, &pid) != STATUS_OK) {
|
||||||
snprintf(errormsg, errormsg_len,
|
strncpy(errormsg, "Startup (fork) of backend failed.",
|
||||||
"Startup (fork) of backend failed.");
|
errormsg_len);
|
||||||
*status = STATUS_ERROR;
|
*status = STATUS_ERROR;
|
||||||
} else {
|
} else {
|
||||||
errormsg[0] = '\0'; /* just for robustness */
|
errormsg[0] = '\0'; /* just for robustness */
|
||||||
|
|||||||
Reference in New Issue
Block a user