From: Benjamin Peterson Date: Wed, 7 Sep 2016 02:03:40 +0000 (-0700) Subject: do not memcpy from NULL X-Git-Tag: v3.6.0b1~247^2~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4a757609d131a29ef52eddcae108b7052e13d31b;p=python do not memcpy from NULL --- diff --git a/Modules/hashtable.c b/Modules/hashtable.c index 133f3133ef..fdddc19cff 100644 --- a/Modules/hashtable.c +++ b/Modules/hashtable.c @@ -327,7 +327,8 @@ _Py_hashtable_set(_Py_hashtable_t *ht, const void *key, entry->key_hash = key_hash; assert(data_size == ht->data_size); - memcpy(_Py_HASHTABLE_ENTRY_DATA(entry), data, data_size); + if (data) + memcpy(_Py_HASHTABLE_ENTRY_DATA(entry), data, data_size); _Py_slist_prepend(&ht->buckets[index], (_Py_slist_item_t*)entry); ht->entries++;