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/transport/plugin_transport_http_common.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/transport/plugin_transport_http_common.c')
-rw-r--r-- | src/transport/plugin_transport_http_common.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c index a01ca233f..eb8320c8e 100644 --- a/src/transport/plugin_transport_http_common.c +++ b/src/transport/plugin_transport_http_common.c | |||
@@ -263,7 +263,7 @@ http_common_plugin_dnsresult_to_address (const char *plugin, | |||
263 | dnsresult, saddr->port, saddr->path); | 263 | dnsresult, saddr->port, saddr->path); |
264 | if (strlen (res) + 1 < 500) | 264 | if (strlen (res) + 1 < 500) |
265 | { | 265 | { |
266 | memcpy (rbuf, res, strlen (res) + 1); | 266 | GNUNET_memcpy (rbuf, res, strlen (res) + 1); |
267 | GNUNET_free(res); | 267 | GNUNET_free(res); |
268 | return rbuf; | 268 | return rbuf; |
269 | } | 269 | } |
@@ -581,7 +581,7 @@ http_common_plugin_address_to_url (void *cls, | |||
581 | if (addr_str[ntohl (address->urlen) - 1] != '\0') | 581 | if (addr_str[ntohl (address->urlen) - 1] != '\0') |
582 | return NULL; | 582 | return NULL; |
583 | 583 | ||
584 | memcpy (rbuf, | 584 | GNUNET_memcpy (rbuf, |
585 | &address[1], | 585 | &address[1], |
586 | ntohl (address->urlen)); | 586 | ntohl (address->urlen)); |
587 | return rbuf; | 587 | return rbuf; |
@@ -623,7 +623,7 @@ http_common_plugin_address_to_string (const char *plugin, | |||
623 | &address[1]); | 623 | &address[1]); |
624 | if (strlen (res) + 1 < 500) | 624 | if (strlen (res) + 1 < 500) |
625 | { | 625 | { |
626 | memcpy (rbuf, res, strlen (res) + 1); | 626 | GNUNET_memcpy (rbuf, res, strlen (res) + 1); |
627 | GNUNET_free(res); | 627 | GNUNET_free(res); |
628 | return rbuf; | 628 | return rbuf; |
629 | } | 629 | } |
@@ -702,7 +702,7 @@ http_common_plugin_string_to_address (void *cls, | |||
702 | a = GNUNET_malloc (sizeof (struct HttpAddress) + urlen); | 702 | a = GNUNET_malloc (sizeof (struct HttpAddress) + urlen); |
703 | a->options = htonl (options); | 703 | a->options = htonl (options); |
704 | a->urlen = htonl (urlen); | 704 | a->urlen = htonl (urlen); |
705 | memcpy (&a[1], address, urlen); | 705 | GNUNET_memcpy (&a[1], address, urlen); |
706 | 706 | ||
707 | (*buf) = a; | 707 | (*buf) = a; |
708 | (*added) = sizeof(struct HttpAddress) + urlen; | 708 | (*added) = sizeof(struct HttpAddress) + urlen; |
@@ -737,7 +737,7 @@ http_common_address_from_socket (const char *protocol, | |||
737 | address = GNUNET_malloc (sizeof (struct HttpAddress) + len); | 737 | address = GNUNET_malloc (sizeof (struct HttpAddress) + len); |
738 | address->options = htonl (HTTP_OPTIONS_NONE); | 738 | address->options = htonl (HTTP_OPTIONS_NONE); |
739 | address->urlen = htonl (len); | 739 | address->urlen = htonl (len); |
740 | memcpy (&address[1], res, len); | 740 | GNUNET_memcpy (&address[1], res, len); |
741 | GNUNET_free(res); | 741 | GNUNET_free(res); |
742 | return address; | 742 | return address; |
743 | } | 743 | } |