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/client.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/client.c')
-rw-r--r-- | src/util/client.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/util/client.c b/src/util/client.c index 8ac3efe88..0ab16a9a1 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -586,7 +586,7 @@ receive_helper (void *cls, | |||
586 | if (client->received_size < client->received_pos + available) | 586 | if (client->received_size < client->received_pos + available) |
587 | GNUNET_array_grow (client->received_buf, client->received_size, | 587 | GNUNET_array_grow (client->received_buf, client->received_size, |
588 | client->received_pos + available); | 588 | client->received_pos + available); |
589 | memcpy (&client->received_buf[client->received_pos], buf, available); | 589 | GNUNET_memcpy (&client->received_buf[client->received_pos], buf, available); |
590 | client->received_pos += available; | 590 | client->received_pos += available; |
591 | check_complete (client); | 591 | check_complete (client); |
592 | /* check for timeout */ | 592 | /* check for timeout */ |
@@ -642,7 +642,7 @@ receive_task (void *cls) | |||
642 | client->service_name); | 642 | client->service_name); |
643 | GNUNET_assert (GNUNET_YES == client->msg_complete); | 643 | GNUNET_assert (GNUNET_YES == client->msg_complete); |
644 | GNUNET_assert (client->received_pos >= msize); | 644 | GNUNET_assert (client->received_pos >= msize); |
645 | memcpy (msg, cmsg, msize); | 645 | GNUNET_memcpy (msg, cmsg, msize); |
646 | memmove (client->received_buf, | 646 | memmove (client->received_buf, |
647 | &client->received_buf[msize], | 647 | &client->received_buf[msize], |
648 | client->received_pos - msize); | 648 | client->received_pos - msize); |
@@ -1371,7 +1371,7 @@ transmit_for_response (void *cls, | |||
1371 | return 0; | 1371 | return 0; |
1372 | } | 1372 | } |
1373 | GNUNET_assert (size >= msize); | 1373 | GNUNET_assert (size >= msize); |
1374 | memcpy (buf, tc->hdr, msize); | 1374 | GNUNET_memcpy (buf, tc->hdr, msize); |
1375 | GNUNET_CLIENT_receive (tc->client, | 1375 | GNUNET_CLIENT_receive (tc->client, |
1376 | tc->rn, | 1376 | tc->rn, |
1377 | tc->rn_cls, | 1377 | tc->rn_cls, |
@@ -1420,7 +1420,7 @@ GNUNET_CLIENT_transmit_and_get_response (struct GNUNET_CLIENT_Connection *client | |||
1420 | tc = GNUNET_malloc (sizeof (struct TransmitGetResponseContext) + msize); | 1420 | tc = GNUNET_malloc (sizeof (struct TransmitGetResponseContext) + msize); |
1421 | tc->client = client; | 1421 | tc->client = client; |
1422 | tc->hdr = (const struct GNUNET_MessageHeader *) &tc[1]; | 1422 | tc->hdr = (const struct GNUNET_MessageHeader *) &tc[1]; |
1423 | memcpy (&tc[1], hdr, msize); | 1423 | GNUNET_memcpy (&tc[1], hdr, msize); |
1424 | tc->timeout = GNUNET_TIME_relative_to_absolute (timeout); | 1424 | tc->timeout = GNUNET_TIME_relative_to_absolute (timeout); |
1425 | tc->rn = rn; | 1425 | tc->rn = rn; |
1426 | tc->rn_cls = rn_cls; | 1426 | tc->rn_cls = rn_cls; |