diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-05-20 23:40:20 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-05-20 23:40:20 +0200 |
commit | d080cb1ed80a0e528b2b755ee48ca18cb670175e (patch) | |
tree | d8c0edab6035e4d38138b303566e972fbf8b8c5f /src/namestore/plugin_namestore_postgres.c | |
parent | 0a8c135eedab5213b31c21b3d4b800e5f0f6041f (diff) |
check return values from GNSRECORD_record_serialize/size always
Diffstat (limited to 'src/namestore/plugin_namestore_postgres.c')
-rw-r--r-- | src/namestore/plugin_namestore_postgres.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c index d7907b1a6e..09fdd760f6 100644 --- a/src/namestore/plugin_namestore_postgres.c +++ b/src/namestore/plugin_namestore_postgres.c @@ -220,7 +220,7 @@ namestore_postgres_store_records (void *cls, struct GNUNET_CRYPTO_EcdsaPublicKey pkey; uint64_t rvalue; uint32_t rd_count32 = (uint32_t) rd_count; - size_t data_size; + ssize_t data_size; memset (&pkey, 0, @@ -238,7 +238,12 @@ namestore_postgres_store_records (void *cls, UINT64_MAX); data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd); - if (data_size > 64 * 65536) + if (data_size < 0) + { + GNUNET_break (0); + return GNUNET_SYSERR; + } + if (data_size >= UINT16_MAX) { GNUNET_break (0); return GNUNET_SYSERR; @@ -287,7 +292,7 @@ namestore_postgres_store_records (void *cls, data_size, data); if ( (ret < 0) || - (data_size != (size_t) ret) ) + (data_size != ret) ) { GNUNET_break (0); return GNUNET_SYSERR; |