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/dv | |
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/dv')
-rw-r--r-- | src/dv/gnunet-service-dv.c | 8 | ||||
-rw-r--r-- | src/dv/plugin_transport_dv.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index d103612a8..2827a17f2 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -452,7 +452,7 @@ send_data_to_plugin (const struct GNUNET_MessageHeader *message, | |||
452 | received_msg->header.type = htons (GNUNET_MESSAGE_TYPE_DV_RECV); | 452 | received_msg->header.type = htons (GNUNET_MESSAGE_TYPE_DV_RECV); |
453 | received_msg->distance = htonl (distance); | 453 | received_msg->distance = htonl (distance); |
454 | received_msg->sender = *origin; | 454 | received_msg->sender = *origin; |
455 | memcpy (&received_msg[1], message, ntohs (message->size)); | 455 | GNUNET_memcpy (&received_msg[1], message, ntohs (message->size)); |
456 | GNUNET_SERVER_notification_context_broadcast (nc, | 456 | GNUNET_SERVER_notification_context_broadcast (nc, |
457 | &received_msg->header, | 457 | &received_msg->header, |
458 | GNUNET_YES); | 458 | GNUNET_YES); |
@@ -580,7 +580,7 @@ core_transmit_notify (void *cls, size_t size, void *buf) | |||
580 | GNUNET_CONTAINER_DLL_remove (dn->pm_head, | 580 | GNUNET_CONTAINER_DLL_remove (dn->pm_head, |
581 | dn->pm_tail, | 581 | dn->pm_tail, |
582 | pending); | 582 | pending); |
583 | memcpy (&cbuf[off], pending->msg, msize); | 583 | GNUNET_memcpy (&cbuf[off], pending->msg, msize); |
584 | GNUNET_free (pending); | 584 | GNUNET_free (pending); |
585 | off += msize; | 585 | off += msize; |
586 | } | 586 | } |
@@ -648,7 +648,7 @@ forward_payload (struct DirectNeighbor *target, | |||
648 | rm->distance = htonl (distance); | 648 | rm->distance = htonl (distance); |
649 | rm->target = *actual_target; | 649 | rm->target = *actual_target; |
650 | rm->sender = *sender; | 650 | rm->sender = *sender; |
651 | memcpy (&rm[1], payload, ntohs (payload->size)); | 651 | GNUNET_memcpy (&rm[1], payload, ntohs (payload->size)); |
652 | GNUNET_CONTAINER_DLL_insert_tail (target->pm_head, | 652 | GNUNET_CONTAINER_DLL_insert_tail (target->pm_head, |
653 | target->pm_tail, | 653 | target->pm_tail, |
654 | pm); | 654 | pm); |
@@ -1500,7 +1500,7 @@ handle_set_union_result (void *cls, | |||
1500 | return; | 1500 | return; |
1501 | } | 1501 | } |
1502 | target = GNUNET_new (struct Target); | 1502 | target = GNUNET_new (struct Target); |
1503 | memcpy (target, element->data, sizeof (struct Target)); | 1503 | GNUNET_memcpy (target, element->data, sizeof (struct Target)); |
1504 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1504 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1505 | "Received information about peer `%s' with distance %u from SET\n", | 1505 | "Received information about peer `%s' with distance %u from SET\n", |
1506 | GNUNET_i2s (&target->peer), | 1506 | GNUNET_i2s (&target->peer), |
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c index 0c72cea3f..51d75330f 100644 --- a/src/dv/plugin_transport_dv.c +++ b/src/dv/plugin_transport_dv.c | |||
@@ -487,7 +487,7 @@ dv_plugin_send (void *cls, | |||
487 | box = GNUNET_malloc (sizeof (struct GNUNET_MessageHeader) + msgbuf_size); | 487 | box = GNUNET_malloc (sizeof (struct GNUNET_MessageHeader) + msgbuf_size); |
488 | box->type = htons (GNUNET_MESSAGE_TYPE_DV_BOX); | 488 | box->type = htons (GNUNET_MESSAGE_TYPE_DV_BOX); |
489 | box->size = htons (sizeof (struct GNUNET_MessageHeader) + msgbuf_size); | 489 | box->size = htons (sizeof (struct GNUNET_MessageHeader) + msgbuf_size); |
490 | memcpy (&box[1], msgbuf, msgbuf_size); | 490 | GNUNET_memcpy (&box[1], msgbuf, msgbuf_size); |
491 | msg = box; | 491 | msg = box; |
492 | } | 492 | } |
493 | GNUNET_DV_send (plugin->dvh, | 493 | GNUNET_DV_send (plugin->dvh, |