aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/plugin_namestore_postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/namestore/plugin_namestore_postgres.c')
-rw-r--r--src/namestore/plugin_namestore_postgres.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index d7907b1a6..7c6acc91b 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -2,20 +2,18 @@
2 * This file is part of GNUnet 2 * This file is part of GNUnet
3 * Copyright (C) 2009-2013, 2016-2018 GNUnet e.V. 3 * Copyright (C) 2009-2013, 2016-2018 GNUnet e.V.
4 * 4 *
5 * GNUnet is free software; you can redistribute it and/or modify 5 * GNUnet is free software: you can redistribute it and/or modify it
6 * it under the terms of the GNU General Public License as published 6 * under the terms of the GNU Affero General Public License as published
7 * by the Free Software Foundation; either version 3, or (at your 7 * by the Free Software Foundation, either version 3 of the License,
8 * option) any later version. 8 * or (at your option) any later version.
9 * 9 *
10 * GNUnet is distributed in the hope that it will be useful, but 10 * GNUnet is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of 11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details. 13 * Affero General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU Affero General Public License
16 * along with GNUnet; see the file COPYING. If not, write to the 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */ 17 */
20 18
21/** 19/**
@@ -220,7 +218,7 @@ namestore_postgres_store_records (void *cls,
220 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 218 struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
221 uint64_t rvalue; 219 uint64_t rvalue;
222 uint32_t rd_count32 = (uint32_t) rd_count; 220 uint32_t rd_count32 = (uint32_t) rd_count;
223 size_t data_size; 221 ssize_t data_size;
224 222
225 memset (&pkey, 223 memset (&pkey,
226 0, 224 0,
@@ -238,7 +236,12 @@ namestore_postgres_store_records (void *cls,
238 UINT64_MAX); 236 UINT64_MAX);
239 data_size = GNUNET_GNSRECORD_records_get_size (rd_count, 237 data_size = GNUNET_GNSRECORD_records_get_size (rd_count,
240 rd); 238 rd);
241 if (data_size > 64 * 65536) 239 if (data_size < 0)
240 {
241 GNUNET_break (0);
242 return GNUNET_SYSERR;
243 }
244 if (data_size >= UINT16_MAX)
242 { 245 {
243 GNUNET_break (0); 246 GNUNET_break (0);
244 return GNUNET_SYSERR; 247 return GNUNET_SYSERR;
@@ -287,7 +290,7 @@ namestore_postgres_store_records (void *cls,
287 data_size, 290 data_size,
288 data); 291 data);
289 if ( (ret < 0) || 292 if ( (ret < 0) ||
290 (data_size != (size_t) ret) ) 293 (data_size != ret) )
291 { 294 {
292 GNUNET_break (0); 295 GNUNET_break (0);
293 return GNUNET_SYSERR; 296 return GNUNET_SYSERR;