Re: Global variables in exec() - Mailing list pgsql-patches

From Tom Lane
Subject Re: Global variables in exec()
Date
Msg-id 22783.1052198897@sss.pgh.pa.us
Whole thread Raw
In response to Global variables in exec()  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Global variables in exec()  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> -
> - typedef uint32 IpcMemoryKey;    /* shared memory key passed to shmget(2) */

IpcMemoryKey is a SysV-specific typedef and has *no* business being
moved out of the sysv-specific port file.  Once again I urge you to
consider making a Windows-specific shmem port file, instead of tromping
all over the Unix code in order to support an API that Windows doesn't
like in the first place :-(

> !     /* database name at the end because it might contain commas */
> !     sprintf(pbuf, "%d,%d,%s", port->sock, UsedShmemSegID, port->database_name);

snprintf please.  I don't think there's any guaranteed limit on the size
of port->database_name these days.

> +                     sscanf(optarg, "%d,%d,", &MyProcPort->sock, &UsedShmemSegID);
> +                     DBName = strdup(strrchr(optarg, ',') + 1);

What happens when the dbname contains a comma?

            regards, tom lane


pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Global variables in exec()
Next
From: Bruce Momjian
Date:
Subject: Re: Global variables in exec()