Re: Win32 fix for pg_dumpall

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Win32 fix for pg_dumpall
Date: 2004-08-16 02:46:58
Message-ID: 200408160246.i7G2kwU24638@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > /*
> > * We emulate fgets() behaviour. So if there is no newline
> > * at the end, we add one...
> > */
> > ! if (line[len-1] != '\n')
> > strcat(line,"\n");
> > }
>
> This is untrustworthy if len is zero. Perhaps
>
> if (len == 0 || line[len-1] != '\n')
> strcat(line,"\n");

Agreed, fixed.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-08-16 03:42:38 Re: 8.0: Absolute path required for INITDB?
Previous Message Tom Lane 2004-08-16 02:13:36 Re: Add GUC_REPORT to server_encoding, integer_datetimes