Re: Win32 fix for pg_dumpall

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(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:01:42
Message-ID: 2729.1092621702@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

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");

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-08-16 02:03:14 Re: 8.0: Absolute path required for INITDB?
Previous Message Bruce Momjian 2004-08-16 01:40:10 Re: psql tab-complete patch #3