Skip to content

Commit 957b90e

Browse files
committed
Fix erroneous error message printout when a configuration file contains
an overlength token. Printout was always garbage and could dump core entirely :-(. Per report from Martin Pitt.
1 parent c826991 commit 957b90e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/libpq/hba.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.121 2004/05/19 22:06:16 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.122 2004/05/25 19:11:14 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -144,14 +144,14 @@ next_token(FILE *fp, char *buf, int bufsz)
144144

145145
if (buf >= end_buf)
146146
{
147+
*buf = '\0';
147148
ereport(LOG,
148149
(errcode(ERRCODE_CONFIG_FILE_ERROR),
149150
errmsg("authentication file token too long, skipping: \"%s\"",
150-
buf)));
151+
start_buf)));
151152
/* Discard remainder of line */
152153
while ((c = getc(fp)) != EOF && c != '\n')
153154
;
154-
buf[0] = '\0';
155155
break;
156156
}
157157

0 commit comments

Comments
 (0)