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/test_core_quota_compliance.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/test_core_quota_compliance.c')
-rw-r--r-- | src/core/test_core_quota_compliance.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index 28d836e2e..5e2db6fcb 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c | |||
@@ -334,7 +334,7 @@ transmit_ready (void *cls, size_t size, void *buf) | |||
334 | hdr.header.size = htons (MESSAGESIZE); | 334 | hdr.header.size = htons (MESSAGESIZE); |
335 | hdr.header.type = htons (MTYPE); | 335 | hdr.header.type = htons (MTYPE); |
336 | hdr.num = htonl (tr_n); | 336 | hdr.num = htonl (tr_n); |
337 | memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); | 337 | GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); |
338 | ret += sizeof (struct TestMessage); | 338 | ret += sizeof (struct TestMessage); |
339 | memset (&cbuf[ret], tr_n, MESSAGESIZE - sizeof (struct TestMessage)); | 339 | memset (&cbuf[ret], tr_n, MESSAGESIZE - sizeof (struct TestMessage)); |
340 | ret += MESSAGESIZE - sizeof (struct TestMessage); | 340 | ret += MESSAGESIZE - sizeof (struct TestMessage); |
@@ -545,7 +545,7 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
545 | "Received (my) `%s' from transport service\n", "HELLO"); | 545 | "Received (my) `%s' from transport service\n", "HELLO"); |
546 | GNUNET_assert (message != NULL); | 546 | GNUNET_assert (message != NULL); |
547 | p->hello = GNUNET_malloc (ntohs (message->size)); | 547 | p->hello = GNUNET_malloc (ntohs (message->size)); |
548 | memcpy (p->hello, message, ntohs (message->size)); | 548 | GNUNET_memcpy (p->hello, message, ntohs (message->size)); |
549 | if ((p == &p1) && (p2.th != NULL)) | 549 | if ((p == &p1) && (p2.th != NULL)) |
550 | GNUNET_TRANSPORT_offer_hello (p2.cfg, message, NULL, NULL); | 550 | GNUNET_TRANSPORT_offer_hello (p2.cfg, message, NULL, NULL); |
551 | if ((p == &p2) && (p1.th != NULL)) | 551 | if ((p == &p2) && (p1.th != NULL)) |