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/core/gnunet-service-core_typemap.c | |
parent | 5184c17d32a39c928c2a0fec3ee1ad098bbaa562 (diff) | |
download | gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.tar.gz gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.zip |
-avoid calling memcpy() with NULL argument, even if len is 0
Diffstat (limited to 'src/core/gnunet-service-core_typemap.c')
-rw-r--r-- | src/core/gnunet-service-core_typemap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/gnunet-service-core_typemap.c b/src/core/gnunet-service-core_typemap.c index 0b3f93a26..d400c0b8b 100644 --- a/src/core/gnunet-service-core_typemap.c +++ b/src/core/gnunet-service-core_typemap.c | |||
@@ -136,7 +136,7 @@ GSC_TYPEMAP_compute_type_map_message () | |||
136 | { | 136 | { |
137 | /* compression failed, use uncompressed map */ | 137 | /* compression failed, use uncompressed map */ |
138 | dlen = sizeof (my_type_map); | 138 | dlen = sizeof (my_type_map); |
139 | memcpy (tmp, &my_type_map, sizeof (my_type_map)); | 139 | GNUNET_memcpy (tmp, &my_type_map, sizeof (my_type_map)); |
140 | hdr->type = htons (GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP); | 140 | hdr->type = htons (GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP); |
141 | } | 141 | } |
142 | else | 142 | else |
@@ -174,7 +174,7 @@ GSC_TYPEMAP_get_from_message (const struct GNUNET_MessageHeader *msg) | |||
174 | return NULL; | 174 | return NULL; |
175 | } | 175 | } |
176 | ret = GNUNET_new (struct GSC_TypeMap); | 176 | ret = GNUNET_new (struct GSC_TypeMap); |
177 | memcpy (ret, &msg[1], sizeof (struct GSC_TypeMap)); | 177 | GNUNET_memcpy (ret, &msg[1], sizeof (struct GSC_TypeMap)); |
178 | return ret; | 178 | return ret; |
179 | case GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP: | 179 | case GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP: |
180 | GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# type maps received"), | 180 | GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# type maps received"), |
@@ -319,7 +319,7 @@ GSC_TYPEMAP_extend (const struct GSC_TypeMap *tmap, | |||
319 | 319 | ||
320 | ret = GNUNET_new (struct GSC_TypeMap); | 320 | ret = GNUNET_new (struct GSC_TypeMap); |
321 | if (NULL != tmap) | 321 | if (NULL != tmap) |
322 | memcpy (ret, tmap, sizeof (struct GSC_TypeMap)); | 322 | GNUNET_memcpy (ret, tmap, sizeof (struct GSC_TypeMap)); |
323 | for (i = 0; i < tcnt; i++) | 323 | for (i = 0; i < tcnt; i++) |
324 | ret->bits[types[i] / 32] |= (1 << (types[i] % 32)); | 324 | ret->bits[types[i] / 32] |= (1 << (types[i] % 32)); |
325 | return ret; | 325 | return ret; |