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/util/mq.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/util/mq.c')
-rw-r--r-- | src/util/mq.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/util/mq.c b/src/util/mq.c index 59a5f177a..9709fb6c8 100644 --- a/src/util/mq.c +++ b/src/util/mq.c | |||
@@ -362,7 +362,7 @@ GNUNET_MQ_send_copy (struct GNUNET_MQ_Handle *mq, | |||
362 | env->mh = (struct GNUNET_MessageHeader *) &env[1]; | 362 | env->mh = (struct GNUNET_MessageHeader *) &env[1]; |
363 | env->sent_cb = ev->sent_cb; | 363 | env->sent_cb = ev->sent_cb; |
364 | env->sent_cls = ev->sent_cls; | 364 | env->sent_cls = ev->sent_cls; |
365 | memcpy (&env[1], | 365 | GNUNET_memcpy (&env[1], |
366 | ev->mh, | 366 | ev->mh, |
367 | msize); | 367 | msize); |
368 | GNUNET_MQ_send (mq, | 368 | GNUNET_MQ_send (mq, |
@@ -460,7 +460,7 @@ GNUNET_MQ_queue_for_callbacks (GNUNET_MQ_SendImpl send, | |||
460 | for (i=0;NULL != handlers[i].cb; i++) ; | 460 | for (i=0;NULL != handlers[i].cb; i++) ; |
461 | mq->handlers = GNUNET_new_array (i + 1, | 461 | mq->handlers = GNUNET_new_array (i + 1, |
462 | struct GNUNET_MQ_MessageHandler); | 462 | struct GNUNET_MQ_MessageHandler); |
463 | memcpy (mq->handlers, | 463 | GNUNET_memcpy (mq->handlers, |
464 | handlers, | 464 | handlers, |
465 | i * sizeof (struct GNUNET_MQ_MessageHandler)); | 465 | i * sizeof (struct GNUNET_MQ_MessageHandler)); |
466 | } | 466 | } |
@@ -564,7 +564,7 @@ GNUNET_MQ_msg_copy (const struct GNUNET_MessageHeader *hdr) | |||
564 | 564 | ||
565 | mqm = GNUNET_malloc (sizeof (*mqm) + size); | 565 | mqm = GNUNET_malloc (sizeof (*mqm) + size); |
566 | mqm->mh = (struct GNUNET_MessageHeader *) &mqm[1]; | 566 | mqm->mh = (struct GNUNET_MessageHeader *) &mqm[1]; |
567 | memcpy (mqm->mh, | 567 | GNUNET_memcpy (mqm->mh, |
568 | hdr, | 568 | hdr, |
569 | size); | 569 | size); |
570 | return mqm; | 570 | return mqm; |
@@ -599,7 +599,7 @@ GNUNET_MQ_msg_nested_mh_ (struct GNUNET_MessageHeader **mhp, | |||
599 | return NULL; | 599 | return NULL; |
600 | 600 | ||
601 | mqm = GNUNET_MQ_msg_ (mhp, size, type); | 601 | mqm = GNUNET_MQ_msg_ (mhp, size, type); |
602 | memcpy ((char *) mqm->mh + base_size, | 602 | GNUNET_memcpy ((char *) mqm->mh + base_size, |
603 | nested_mh, | 603 | nested_mh, |
604 | ntohs (nested_mh->size)); | 604 | ntohs (nested_mh->size)); |
605 | 605 | ||
@@ -628,7 +628,7 @@ transmit_queued (void *cls, | |||
628 | GNUNET_assert (NULL != buf); | 628 | GNUNET_assert (NULL != buf); |
629 | msg_size = ntohs (msg->size); | 629 | msg_size = ntohs (msg->size); |
630 | GNUNET_assert (size >= msg_size); | 630 | GNUNET_assert (size >= msg_size); |
631 | memcpy (buf, msg, msg_size); | 631 | GNUNET_memcpy (buf, msg, msg_size); |
632 | state->th = NULL; | 632 | state->th = NULL; |
633 | 633 | ||
634 | GNUNET_MQ_impl_send_continue (mq); | 634 | GNUNET_MQ_impl_send_continue (mq); |
@@ -756,7 +756,7 @@ connection_client_transmit_queued (void *cls, | |||
756 | 756 | ||
757 | msg_size = ntohs (msg->size); | 757 | msg_size = ntohs (msg->size); |
758 | GNUNET_assert (size >= msg_size); | 758 | GNUNET_assert (size >= msg_size); |
759 | memcpy (buf, msg, msg_size); | 759 | GNUNET_memcpy (buf, msg, msg_size); |
760 | state->th = NULL; | 760 | state->th = NULL; |
761 | 761 | ||
762 | GNUNET_MQ_impl_send_continue (mq); | 762 | GNUNET_MQ_impl_send_continue (mq); |
@@ -829,7 +829,7 @@ GNUNET_MQ_queue_for_connection_client (struct GNUNET_CLIENT_Connection *connecti | |||
829 | for (i=0;NULL != handlers[i].cb; i++) ; | 829 | for (i=0;NULL != handlers[i].cb; i++) ; |
830 | mq->handlers = GNUNET_new_array (i, | 830 | mq->handlers = GNUNET_new_array (i, |
831 | struct GNUNET_MQ_MessageHandler); | 831 | struct GNUNET_MQ_MessageHandler); |
832 | memcpy (mq->handlers, | 832 | GNUNET_memcpy (mq->handlers, |
833 | handlers, | 833 | handlers, |
834 | i * sizeof (struct GNUNET_MQ_MessageHandler)); | 834 | i * sizeof (struct GNUNET_MQ_MessageHandler)); |
835 | } | 835 | } |