We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent33b2a2c commitf2874feCopy full SHA for f2874fe
src/backend/optimizer/plan/setrefs.c
@@ -41,9 +41,8 @@ typedef struct
41
intnum_vars;/* number of plain Var tlist entries */
42
boolhas_ph_vars;/* are there PlaceHolderVar entries? */
43
boolhas_non_vars;/* are there other entries? */
44
-/* array of num_vars entries: */
45
-tlist_vinfovars[1];/* VARIABLE LENGTH ARRAY */
46
-}indexed_tlist;/* VARIABLE LENGTH STRUCT */
+tlist_vinfovars[FLEXIBLE_ARRAY_MEMBER];/* has num_vars entries */
+}indexed_tlist;
47
48
typedefstruct
49
{
src/include/access/brin_page.h
@@ -56,7 +56,12 @@ typedef struct BrinMetaPageData
56
/* Definitions for revmap pages */
57
typedefstructRevmapContents
58
59
-ItemPointerDatarm_tids[1];/* really REVMAP_PAGE_MAXITEMS */
+/*
60
+ * This array will fill all available space on the page. It should be
61
+ * declared [FLEXIBLE_ARRAY_MEMBER], but for some reason you can't do that
62
+ * in an otherwise-empty struct.
63
+ */
64
+ItemPointerDatarm_tids[1];
65
}RevmapContents;
66
67
#defineREVMAP_CONTENT_SIZE \
src/include/replication/slot.h
@@ -130,6 +130,10 @@ typedef struct ReplicationSlot
130
*/
131
typedefstructReplicationSlotCtlData
132
133
134
+ * This array should be declared [FLEXIBLE_ARRAY_MEMBER], but for some
135
+ * reason you can't do that in an otherwise-empty struct.
136
137
ReplicationSlotreplication_slots[1];
138
}ReplicationSlotCtlData;
139
src/interfaces/libpq/fe-exec.c
@@ -892,7 +892,8 @@ pqSaveMessageField(PGresult *res, char code, const char *value)
892
893
pfield= (PGMessageField*)
894
pqResultAlloc(res,
895
-sizeof(PGMessageField)+strlen(value),
+ offsetof(PGMessageField,contents)+
896
+strlen(value)+1,
897
TRUE);
898
if (!pfield)
899
return;/* out of memory? */
src/interfaces/libpq/libpq-int.h
@@ -145,7 +145,7 @@ typedef struct pgMessageField
145
146
structpgMessageField*next;/* list link */
147
charcode;/* field code */
148
-charcontents[1];/*fieldvalue (VARIABLE LENGTH) */
+charcontents[FLEXIBLE_ARRAY_MEMBER];/* value, nul-terminated */
149
}PGMessageField;
150
151
/* Fields needed for notice handling */
@@ -637,7 +637,7 @@ extern void pq_reset_sigpipe(sigset_t *osigset, bool sigpipe_pending,
637
* The SSL implementatation provides these functions (fe-secure-openssl.c)
638
639
externvoidpgtls_init_library(booldo_ssl,intdo_crypto);
640
-externintpgtls_init(PGconn*conn);
+externintpgtls_init(PGconn*conn);
641
externPostgresPollingStatusTypepgtls_open_client(PGconn*conn);
642
externvoidpgtls_close(PGconn*conn);
643
externssize_tpgtls_read(PGconn*conn,void*ptr,size_tlen);
src/pl/plpgsql/src/pl_funcs.c
@@ -97,7 +97,7 @@ plpgsql_ns_additem(int itemtype, int itemno, const char *name)
97
/* first item added must be a label */
98
Assert(ns_top!=NULL||itemtype==PLPGSQL_NSTYPE_LABEL);
99
100
-nse=palloc(sizeof(PLpgSQL_nsitem)+strlen(name));
+nse=palloc(offsetof(PLpgSQL_nsitem,name)+strlen(name)+1);
101
nse->itemtype=itemtype;
102
nse->itemno=itemno;
103
nse->prev=ns_top;
src/pl/plpgsql/src/plpgsql.h
@@ -329,7 +329,7 @@ typedef struct PLpgSQL_nsitem
329
intitemtype;
330
intitemno;
331
structPLpgSQL_nsitem*prev;
332
-charname[1];/*actually, as long as needed */
+charname[FLEXIBLE_ARRAY_MEMBER];/*nul-terminated string */
333
}PLpgSQL_nsitem;
334
335