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/identity | |
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/identity')
-rw-r--r-- | src/identity/gnunet-service-identity.c | 6 | ||||
-rw-r--r-- | src/identity/identity_api.c | 12 | ||||
-rw-r--r-- | src/identity/plugin_gnsrecord_identity.c | 2 | ||||
-rw-r--r-- | src/identity/plugin_rest_identity.c | 4 |
4 files changed, 12 insertions, 12 deletions
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c index 9185aac64..b868719c3 100644 --- a/src/identity/gnunet-service-identity.c +++ b/src/identity/gnunet-service-identity.c | |||
@@ -190,7 +190,7 @@ send_result_code (struct GNUNET_SERVER_Client *client, | |||
190 | rcm->header.size = htons (sizeof (struct GNUNET_IDENTITY_ResultCodeMessage) + elen); | 190 | rcm->header.size = htons (sizeof (struct GNUNET_IDENTITY_ResultCodeMessage) + elen); |
191 | rcm->result_code = htonl (result_code); | 191 | rcm->result_code = htonl (result_code); |
192 | if (0 < elen) | 192 | if (0 < elen) |
193 | memcpy (&rcm[1], emsg, elen); | 193 | GNUNET_memcpy (&rcm[1], emsg, elen); |
194 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 194 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
195 | "Sending result %d (%s) to client\n", | 195 | "Sending result %d (%s) to client\n", |
196 | (int) result_code, | 196 | (int) result_code, |
@@ -219,7 +219,7 @@ create_update_message (struct Ego *ego) | |||
219 | um->name_len = htons (name_len); | 219 | um->name_len = htons (name_len); |
220 | um->end_of_list = htons (GNUNET_NO); | 220 | um->end_of_list = htons (GNUNET_NO); |
221 | um->private_key = *ego->pk; | 221 | um->private_key = *ego->pk; |
222 | memcpy (&um[1], ego->identifier, name_len); | 222 | GNUNET_memcpy (&um[1], ego->identifier, name_len); |
223 | return um; | 223 | return um; |
224 | } | 224 | } |
225 | 225 | ||
@@ -245,7 +245,7 @@ create_set_default_message (struct Ego *ego, | |||
245 | sdm->name_len = htons (name_len); | 245 | sdm->name_len = htons (name_len); |
246 | sdm->reserved = htons (0); | 246 | sdm->reserved = htons (0); |
247 | sdm->private_key = *ego->pk; | 247 | sdm->private_key = *ego->pk; |
248 | memcpy (&sdm[1], servicename, name_len); | 248 | GNUNET_memcpy (&sdm[1], servicename, name_len); |
249 | return sdm; | 249 | return sdm; |
250 | } | 250 | } |
251 | 251 | ||
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index 215433704..4c8a35dc2 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c | |||
@@ -688,7 +688,7 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *h, | |||
688 | GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT); | 688 | GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT); |
689 | gdm->name_len = htons (slen); | 689 | gdm->name_len = htons (slen); |
690 | gdm->reserved = htons (0); | 690 | gdm->reserved = htons (0); |
691 | memcpy (&gdm[1], | 691 | GNUNET_memcpy (&gdm[1], |
692 | service_name, | 692 | service_name, |
693 | slen); | 693 | slen); |
694 | GNUNET_MQ_send (h->mq, | 694 | GNUNET_MQ_send (h->mq, |
@@ -740,7 +740,7 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h, | |||
740 | sdm->name_len = htons (slen); | 740 | sdm->name_len = htons (slen); |
741 | sdm->reserved = htons (0); | 741 | sdm->reserved = htons (0); |
742 | sdm->private_key = *ego->pk; | 742 | sdm->private_key = *ego->pk; |
743 | memcpy (&sdm[1], | 743 | GNUNET_memcpy (&sdm[1], |
744 | service_name, | 744 | service_name, |
745 | slen); | 745 | slen); |
746 | GNUNET_MQ_send (h->mq, | 746 | GNUNET_MQ_send (h->mq, |
@@ -793,7 +793,7 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h, | |||
793 | pk = GNUNET_CRYPTO_ecdsa_key_create (); | 793 | pk = GNUNET_CRYPTO_ecdsa_key_create (); |
794 | crm->private_key = *pk; | 794 | crm->private_key = *pk; |
795 | GNUNET_free (pk); | 795 | GNUNET_free (pk); |
796 | memcpy (&crm[1], | 796 | GNUNET_memcpy (&crm[1], |
797 | name, | 797 | name, |
798 | slen); | 798 | slen); |
799 | GNUNET_MQ_send (h->mq, | 799 | GNUNET_MQ_send (h->mq, |
@@ -850,10 +850,10 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *h, | |||
850 | grm->old_name_len = htons (slen_old); | 850 | grm->old_name_len = htons (slen_old); |
851 | grm->new_name_len = htons (slen_new); | 851 | grm->new_name_len = htons (slen_new); |
852 | dst = (char *) &grm[1]; | 852 | dst = (char *) &grm[1]; |
853 | memcpy (dst, | 853 | GNUNET_memcpy (dst, |
854 | old_name, | 854 | old_name, |
855 | slen_old); | 855 | slen_old); |
856 | memcpy (&dst[slen_old], | 856 | GNUNET_memcpy (&dst[slen_old], |
857 | new_name, | 857 | new_name, |
858 | slen_new); | 858 | slen_new); |
859 | GNUNET_MQ_send (h->mq, | 859 | GNUNET_MQ_send (h->mq, |
@@ -902,7 +902,7 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *h, | |||
902 | GNUNET_MESSAGE_TYPE_IDENTITY_DELETE); | 902 | GNUNET_MESSAGE_TYPE_IDENTITY_DELETE); |
903 | gdm->name_len = htons (slen); | 903 | gdm->name_len = htons (slen); |
904 | gdm->reserved = htons (0); | 904 | gdm->reserved = htons (0); |
905 | memcpy (&gdm[1], | 905 | GNUNET_memcpy (&gdm[1], |
906 | name, | 906 | name, |
907 | slen); | 907 | slen); |
908 | GNUNET_MQ_send (h->mq, | 908 | GNUNET_MQ_send (h->mq, |
diff --git a/src/identity/plugin_gnsrecord_identity.c b/src/identity/plugin_gnsrecord_identity.c index 3fd47bd02..c26c04074 100644 --- a/src/identity/plugin_gnsrecord_identity.c +++ b/src/identity/plugin_gnsrecord_identity.c | |||
@@ -146,7 +146,7 @@ string_to_value (void *cls, | |||
146 | write_ptr, | 146 | write_ptr, |
147 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | 147 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); |
148 | write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); | 148 | write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); |
149 | memcpy (write_ptr, str, strlen (str) + 1); //with 0-Terminator | 149 | GNUNET_memcpy (write_ptr, str, strlen (str) + 1); //with 0-Terminator |
150 | GNUNET_free (tmp_tok); | 150 | GNUNET_free (tmp_tok); |
151 | return GNUNET_OK; | 151 | return GNUNET_OK; |
152 | 152 | ||
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c index aa8a5ca60..e64b2685a 100644 --- a/src/identity/plugin_rest_identity.c +++ b/src/identity/plugin_rest_identity.c | |||
@@ -517,7 +517,7 @@ ego_create_cont (struct GNUNET_REST_RequestHandle *con, | |||
517 | return; | 517 | return; |
518 | } | 518 | } |
519 | term_data[handle->data_size] = '\0'; | 519 | term_data[handle->data_size] = '\0'; |
520 | memcpy (term_data, handle->data, handle->data_size); | 520 | GNUNET_memcpy (term_data, handle->data, handle->data_size); |
521 | data_js = json_loads (term_data, | 521 | data_js = json_loads (term_data, |
522 | JSON_DECODE_ANY, | 522 | JSON_DECODE_ANY, |
523 | &err); | 523 | &err); |
@@ -646,7 +646,7 @@ ego_edit_cont (struct GNUNET_REST_RequestHandle *con, | |||
646 | } | 646 | } |
647 | 647 | ||
648 | term_data[handle->data_size] = '\0'; | 648 | term_data[handle->data_size] = '\0'; |
649 | memcpy (term_data, handle->data, handle->data_size); | 649 | GNUNET_memcpy (term_data, handle->data, handle->data_size); |
650 | data_js = json_loads (term_data, | 650 | data_js = json_loads (term_data, |
651 | JSON_DECODE_ANY, | 651 | JSON_DECODE_ANY, |
652 | &err); | 652 | &err); |