1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Some more FLEXIBLE_ARRAY_MEMBER fixes.

This commit is contained in:
Tom Lane
2015-02-21 01:46:43 -05:00
parent 33b2a2c97f
commit f2874feb7c
7 changed files with 18 additions and 9 deletions

View File

@@ -97,7 +97,7 @@ plpgsql_ns_additem(int itemtype, int itemno, const char *name)
/* first item added must be a label */
Assert(ns_top != NULL || itemtype == PLPGSQL_NSTYPE_LABEL);
nse = palloc(sizeof(PLpgSQL_nsitem) + strlen(name));
nse = palloc(offsetof(PLpgSQL_nsitem, name) +strlen(name) + 1);
nse->itemtype = itemtype;
nse->itemno = itemno;
nse->prev = ns_top;

View File

@@ -329,7 +329,7 @@ typedef struct PLpgSQL_nsitem
int itemtype;
int itemno;
struct PLpgSQL_nsitem *prev;
char name[1]; /* actually, as long as needed */
char name[FLEXIBLE_ARRAY_MEMBER]; /* nul-terminated string */
} PLpgSQL_nsitem;