diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-08 17:20:23 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-08 17:20:23 +0000 |
commit | d8c53b12a818ff7cf82d06a1a69c395bdef85ee6 (patch) | |
tree | 0ebb0db416c157fcfde51a941185819dd12d51fd /src/datacache | |
parent | 5184c17d32a39c928c2a0fec3ee1ad098bbaa562 (diff) |
-avoid calling memcpy() with NULL argument, even if len is 0
Diffstat (limited to 'src/datacache')
-rw-r--r-- | src/datacache/plugin_datacache_heap.c | 6 | ||||
-rw-r--r-- | src/datacache/plugin_datacache_postgres.c | 2 | ||||
-rw-r--r-- | src/datacache/plugin_datacache_sqlite.c | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/datacache/plugin_datacache_heap.c b/src/datacache/plugin_datacache_heap.c index afc320b206..185d54f2f8 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 e5b2505310..147bb42234 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 2807cf7ebe..5567077d3f 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, |