summaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorTom Lane2015-02-21 06:46:43 +0000
committerTom Lane2015-02-21 06:46:43 +0000
commitf2874feb7c4e71200539c0287544eeebd8fcb3d4 (patch)
tree27c53b200f890ce2d568cd12674f93644678e3eb /src/interfaces
parent33b2a2c97f3dd4cf8bbc2c020e34129886367b72 (diff)
Some more FLEXIBLE_ARRAY_MEMBER fixes.
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/libpq/fe-exec.c3
-rw-r--r--src/interfaces/libpq/libpq-int.h4
2 files changed, 4 insertions, 3 deletions
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index 691202894f..3d46e15067 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -892,7 +892,8 @@ pqSaveMessageField(PGresult *res, char code, const char *value)
pfield = (PGMessageField *)
pqResultAlloc(res,
- sizeof(PGMessageField) + strlen(value),
+ offsetof(PGMessageField, contents) +
+ strlen(value) + 1,
TRUE);
if (!pfield)
return; /* out of memory? */
diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h
index 008fd67c5b..64579d2940 100644
--- a/src/interfaces/libpq/libpq-int.h
+++ b/src/interfaces/libpq/libpq-int.h
@@ -145,7 +145,7 @@ typedef struct pgMessageField
{
struct pgMessageField *next; /* list link */
char code; /* field code */
- char contents[1]; /* field value (VARIABLE LENGTH) */
+ char contents[FLEXIBLE_ARRAY_MEMBER]; /* value, nul-terminated */
} PGMessageField;
/* Fields needed for notice handling */
@@ -637,7 +637,7 @@ extern void pq_reset_sigpipe(sigset_t *osigset, bool sigpipe_pending,
* The SSL implementatation provides these functions (fe-secure-openssl.c)
*/
extern void pgtls_init_library(bool do_ssl, int do_crypto);
-extern int pgtls_init(PGconn *conn);
+extern int pgtls_init(PGconn *conn);
extern PostgresPollingStatusType pgtls_open_client(PGconn *conn);
extern void pgtls_close(PGconn *conn);
extern ssize_t pgtls_read(PGconn *conn, void *ptr, size_t len);