The attached space adds '\0' as a whitespace character and prevents pg_ctl from running out of bounds when processing arguments for -o. I don't think this ever worked, at least on Mac, but I suspect every platform suffered from this bug.

% gdb ./bin/pg_ctl
GNU gdb 5.3-20030128 (Apple version gdb-309) (Thu Dec 4 15:41:30 GMT 2003)
This GDB was configured as "powerpc-apple-darwin".
Reading symbols for shared libraries ........ done
(gdb) set arg -w -o -F start
(gdb) run
Starting program: /usr/local/pgsql/bin/pg_ctl -w -o -F start
Reading symbols for shared libraries ++.. done
waiting for postmaster to start...
Program received signal EXC_BAD_ACCESS, Could not access memory.
test_postmaster_connection () at pg_ctl.c:363
363 p++;
(gdb) bt
#0 test_postmaster_connection () at pg_ctl.c:363
#1 0x00003594 in do_start () at pg_ctl.c:539
#2 0x00003594 in do_start () at pg_ctl.c:539
#3 0x00004874 in main (argc=-1610604968, argv=0x0) at pg_ctl.c:1360
(gdb) p *p
$1 = 0 '\0'


-sc
Index: pg_ctl.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/bin/pg_ctl/pg_ctl.c,v
retrieving revision 1.23
diff -u -r1.23 pg_ctl.c
--- pg_ctl.c    22 Jul 2004 01:44:36 -0000      1.23
+++ pg_ctl.c    26 Jul 2004 18:53:52 -0000
@@ -30,7 +30,7 @@
 
 #define _(x) gettext((x))
 
-#define WHITESPACE "\f\n\r\t\v"                /* as defined by isspace() */
+#define WHITESPACE "\f\n\r\t\v\0"      /* as defined by isspace() */
 
 /* postmaster version ident string */
 #define PM_VERSIONSTR "postmaster (PostgreSQL) " PG_VERSION "\n"

-- Sean Chittenden
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to