From: Tom Lane Date: Tue, 25 May 2004 19:11:26 +0000 (+0000) Subject: Fix erroneous error message printout when a configuration file contains X-Git-Tag: REL7_4_3~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=360dcb13413103328e6b0f519561c3a7eff9a232;p=postgresql 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. --- diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index 6b32c34214..5e8903d6ac 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.116.2.1 2003/12/05 15:50:39 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.116.2.2 2004/05/25 19:11:26 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -124,14 +124,14 @@ next_token(FILE *fp, char *buf, const int bufsz) if (buf >= end_buf) { + *buf = '\0'; ereport(LOG, (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("authentication file token too long, skipping: \"%s\"", - buf))); + start_buf))); /* Discard remainder of line */ while ((c = getc(fp)) != EOF && c != '\n') ; - buf[0] = '\0'; break; }