From d8c53b12a818ff7cf82d06a1a69c395bdef85ee6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 8 Jul 2016 17:20:23 +0000 Subject: -avoid calling memcpy() with NULL argument, even if len is 0 --- src/datacache/plugin_datacache_heap.c | 6 +++--- src/datacache/plugin_datacache_postgres.c | 2 +- src/datacache/plugin_datacache_sqlite.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/datacache') 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, GNUNET_array_grow (val->path_info, val->path_info_len, put_ctx->path_info_len); - memcpy (val->path_info, + GNUNET_memcpy (val->path_info, put_ctx->path_info, put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity)); GNUNET_CONTAINER_heap_update_cost (put_ctx->heap, @@ -237,7 +237,7 @@ heap_plugin_put (void *cls, if (GNUNET_YES == put_ctx.found) return 0; val = GNUNET_malloc (sizeof (struct Value) + size); - memcpy (&val[1], data, size); + GNUNET_memcpy (&val[1], data, size); val->key = *key; val->type = type; val->discard_time = discard_time; @@ -245,7 +245,7 @@ heap_plugin_put (void *cls, GNUNET_array_grow (val->path_info, val->path_info_len, path_info_len); - memcpy (val->path_info, + GNUNET_memcpy (val->path_info, path_info, path_info_len * sizeof (struct GNUNET_PeerIdentity)); (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) } size = ntohl (*(uint32_t *) PQgetvalue (res, 0, 0)); oid = ntohl (*(uint32_t *) PQgetvalue (res, 0, 1)); - memcpy (&key, PQgetvalue (res, 0, 2), sizeof (struct GNUNET_HashCode)); + GNUNET_memcpy (&key, PQgetvalue (res, 0, 2), sizeof (struct GNUNET_HashCode)); PQclear (res); if (GNUNET_OK != 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) } rowid = sqlite3_column_int64 (stmt, 0); GNUNET_assert (sqlite3_column_bytes (stmt, 1) == sizeof (struct GNUNET_HashCode)); - memcpy (&hc, sqlite3_column_blob (stmt, 1), sizeof (struct GNUNET_HashCode)); + GNUNET_memcpy (&hc, sqlite3_column_blob (stmt, 1), sizeof (struct GNUNET_HashCode)); dsize = sqlite3_column_bytes (stmt, 2); if (SQLITE_OK != sqlite3_finalize (stmt)) LOG_SQLITE (plugin->dbh, -- cgit v1.2.3