pg_ctl infinite loop and memory leak

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: pg_ctl infinite loop and memory leak
Date: 2009-09-01 20:52:22
Message-ID: 1251838342.31412.144.camel@monkey-cat.sm.truviso.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

To reproduce:

1. initdb -D data
2. cat /dev/null > data/postgresql.conf
3. pg_ctl -w -D data start

I attached a quick patch that seems to do the trick. It appears that
fgets() will always return non-NULL if the size passed in is 1 (i.e.
maxlength in the caller is 0).

The patch also changes the same readfile() function in initdb.c. I
assume it's not a practical problem there, but it should be fixed.

Thanks to Corry Haines (chaines at truviso dot com) for reporting the
problem.

Regards,
Jeff Davis

Attachment Content-Type Size
pg_ctl.patch text/x-patch 1.0 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Davis 2009-09-01 23:48:06 Re: BUG #5028: CASE returns ELSE value always when type is "char"
Previous Message Kevin Grittner 2009-09-01 18:49:11 Re: BUG #5028: CASE returns ELSE value always when type is "char"