aboutsummaryrefslogtreecommitdiff
path: root/src/datacache
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-08 17:20:23 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-08 17:20:23 +0000
commitd8c53b12a818ff7cf82d06a1a69c395bdef85ee6 (patch)
tree0ebb0db416c157fcfde51a941185819dd12d51fd /src/datacache
parent5184c17d32a39c928c2a0fec3ee1ad098bbaa562 (diff)
downloadgnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.tar.gz
gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.zip
-avoid calling memcpy() with NULL argument, even if len is 0
Diffstat (limited to 'src/datacache')
-rw-r--r--src/datacache/plugin_datacache_heap.c6
-rw-r--r--src/datacache/plugin_datacache_postgres.c2
-rw-r--r--src/datacache/plugin_datacache_sqlite.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/datacache/plugin_datacache_heap.c b/src/datacache/plugin_datacache_heap.c
index afc320b20..185d54f2f 100644
--- a/src/datacache/plugin_datacache_heap.c
+++ b/src/datacache/plugin_datacache_heap.c
@@ -177,7 +177,7 @@ put_cb (void *cls,
177 GNUNET_array_grow (val->path_info, 177 GNUNET_array_grow (val->path_info,
178 val->path_info_len, 178 val->path_info_len,
179 put_ctx->path_info_len); 179 put_ctx->path_info_len);
180 memcpy (val->path_info, 180 GNUNET_memcpy (val->path_info,
181 put_ctx->path_info, 181 put_ctx->path_info,
182 put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity)); 182 put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity));
183 GNUNET_CONTAINER_heap_update_cost (put_ctx->heap, 183 GNUNET_CONTAINER_heap_update_cost (put_ctx->heap,
@@ -237,7 +237,7 @@ heap_plugin_put (void *cls,
237 if (GNUNET_YES == put_ctx.found) 237 if (GNUNET_YES == put_ctx.found)
238 return 0; 238 return 0;
239 val = GNUNET_malloc (sizeof (struct Value) + size); 239 val = GNUNET_malloc (sizeof (struct Value) + size);
240 memcpy (&val[1], data, size); 240 GNUNET_memcpy (&val[1], data, size);
241 val->key = *key; 241 val->key = *key;
242 val->type = type; 242 val->type = type;
243 val->discard_time = discard_time; 243 val->discard_time = discard_time;
@@ -245,7 +245,7 @@ heap_plugin_put (void *cls,
245 GNUNET_array_grow (val->path_info, 245 GNUNET_array_grow (val->path_info,
246 val->path_info_len, 246 val->path_info_len,
247 path_info_len); 247 path_info_len);
248 memcpy (val->path_info, 248 GNUNET_memcpy (val->path_info,
249 path_info, 249 path_info,
250 path_info_len * sizeof (struct GNUNET_PeerIdentity)); 250 path_info_len * sizeof (struct GNUNET_PeerIdentity));
251 (void) GNUNET_CONTAINER_multihashmap_put (plugin->map, 251 (void) GNUNET_CONTAINER_multihashmap_put (plugin->map,
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c
index e5b250531..147bb4223 100644
--- a/src/datacache/plugin_datacache_postgres.c
+++ b/src/datacache/plugin_datacache_postgres.c
@@ -399,7 +399,7 @@ postgres_plugin_del (void *cls)
399 } 399 }
400 size = ntohl (*(uint32_t *) PQgetvalue (res, 0, 0)); 400 size = ntohl (*(uint32_t *) PQgetvalue (res, 0, 0));
401 oid = ntohl (*(uint32_t *) PQgetvalue (res, 0, 1)); 401 oid = ntohl (*(uint32_t *) PQgetvalue (res, 0, 1));
402 memcpy (&key, PQgetvalue (res, 0, 2), sizeof (struct GNUNET_HashCode)); 402 GNUNET_memcpy (&key, PQgetvalue (res, 0, 2), sizeof (struct GNUNET_HashCode));
403 PQclear (res); 403 PQclear (res);
404 if (GNUNET_OK != 404 if (GNUNET_OK !=
405 GNUNET_POSTGRES_delete_by_rowid (plugin->dbh, 405 GNUNET_POSTGRES_delete_by_rowid (plugin->dbh,
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c
index 2807cf7eb..5567077d3 100644
--- a/src/datacache/plugin_datacache_sqlite.c
+++ b/src/datacache/plugin_datacache_sqlite.c
@@ -386,7 +386,7 @@ sqlite_plugin_del (void *cls)
386 } 386 }
387 rowid = sqlite3_column_int64 (stmt, 0); 387 rowid = sqlite3_column_int64 (stmt, 0);
388 GNUNET_assert (sqlite3_column_bytes (stmt, 1) == sizeof (struct GNUNET_HashCode)); 388 GNUNET_assert (sqlite3_column_bytes (stmt, 1) == sizeof (struct GNUNET_HashCode));
389 memcpy (&hc, sqlite3_column_blob (stmt, 1), sizeof (struct GNUNET_HashCode)); 389 GNUNET_memcpy (&hc, sqlite3_column_blob (stmt, 1), sizeof (struct GNUNET_HashCode));
390 dsize = sqlite3_column_bytes (stmt, 2); 390 dsize = sqlite3_column_bytes (stmt, 2);
391 if (SQLITE_OK != sqlite3_finalize (stmt)) 391 if (SQLITE_OK != sqlite3_finalize (stmt))
392 LOG_SQLITE (plugin->dbh, 392 LOG_SQLITE (plugin->dbh,