diff options
Diffstat (limited to 'src/dns/dnsparser.c')
-rw-r--r-- | src/dns/dnsparser.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/dns/dnsparser.c b/src/dns/dnsparser.c index 5041d29a8..36b4c36f1 100644 --- a/src/dns/dnsparser.c +++ b/src/dns/dnsparser.c | |||
@@ -385,7 +385,7 @@ GNUNET_DNSPARSER_parse_query (const char *udp_payload, | |||
385 | GNUNET_break_op (0); | 385 | GNUNET_break_op (0); |
386 | return GNUNET_SYSERR; | 386 | return GNUNET_SYSERR; |
387 | } | 387 | } |
388 | memcpy (&ql, &udp_payload[*off], sizeof (ql)); | 388 | GNUNET_memcpy (&ql, &udp_payload[*off], sizeof (ql)); |
389 | *off += sizeof (ql); | 389 | *off += sizeof (ql); |
390 | q->type = ntohs (ql.type); | 390 | q->type = ntohs (ql.type); |
391 | q->dns_traffic_class = ntohs (ql.dns_traffic_class); | 391 | q->dns_traffic_class = ntohs (ql.dns_traffic_class); |
@@ -428,7 +428,7 @@ GNUNET_DNSPARSER_parse_soa (const char *udp_payload, | |||
428 | *off = old_off; | 428 | *off = old_off; |
429 | return NULL; | 429 | return NULL; |
430 | } | 430 | } |
431 | memcpy (&soa_bin, | 431 | GNUNET_memcpy (&soa_bin, |
432 | &udp_payload[*off], | 432 | &udp_payload[*off], |
433 | sizeof (struct GNUNET_TUN_DnsSoaRecord)); | 433 | sizeof (struct GNUNET_TUN_DnsSoaRecord)); |
434 | soa->serial = ntohl (soa_bin.serial); | 434 | soa->serial = ntohl (soa_bin.serial); |
@@ -465,7 +465,7 @@ GNUNET_DNSPARSER_parse_mx (const char *udp_payload, | |||
465 | GNUNET_break_op (0); | 465 | GNUNET_break_op (0); |
466 | return NULL; | 466 | return NULL; |
467 | } | 467 | } |
468 | memcpy (&mxpref, &udp_payload[*off], sizeof (uint16_t)); | 468 | GNUNET_memcpy (&mxpref, &udp_payload[*off], sizeof (uint16_t)); |
469 | (*off) += sizeof (uint16_t); | 469 | (*off) += sizeof (uint16_t); |
470 | mx = GNUNET_new (struct GNUNET_DNSPARSER_MxRecord); | 470 | mx = GNUNET_new (struct GNUNET_DNSPARSER_MxRecord); |
471 | mx->preference = ntohs (mxpref); | 471 | mx->preference = ntohs (mxpref); |
@@ -504,7 +504,7 @@ GNUNET_DNSPARSER_parse_srv (const char *udp_payload, | |||
504 | old_off = *off; | 504 | old_off = *off; |
505 | if (*off + sizeof (struct GNUNET_TUN_DnsSrvRecord) > udp_payload_length) | 505 | if (*off + sizeof (struct GNUNET_TUN_DnsSrvRecord) > udp_payload_length) |
506 | return NULL; | 506 | return NULL; |
507 | memcpy (&srv_bin, | 507 | GNUNET_memcpy (&srv_bin, |
508 | &udp_payload[*off], | 508 | &udp_payload[*off], |
509 | sizeof (struct GNUNET_TUN_DnsSrvRecord)); | 509 | sizeof (struct GNUNET_TUN_DnsSrvRecord)); |
510 | (*off) += sizeof (struct GNUNET_TUN_DnsSrvRecord); | 510 | (*off) += sizeof (struct GNUNET_TUN_DnsSrvRecord); |
@@ -547,7 +547,7 @@ GNUNET_DNSPARSER_parse_cert (const char *udp_payload, | |||
547 | GNUNET_break_op (0); | 547 | GNUNET_break_op (0); |
548 | return NULL; | 548 | return NULL; |
549 | } | 549 | } |
550 | memcpy (&dcert, &udp_payload[*off], sizeof (struct GNUNET_TUN_DnsCertRecord)); | 550 | GNUNET_memcpy (&dcert, &udp_payload[*off], sizeof (struct GNUNET_TUN_DnsCertRecord)); |
551 | (*off) += sizeof (struct GNUNET_TUN_DnsCertRecord); | 551 | (*off) += sizeof (struct GNUNET_TUN_DnsCertRecord); |
552 | cert = GNUNET_new (struct GNUNET_DNSPARSER_CertRecord); | 552 | cert = GNUNET_new (struct GNUNET_DNSPARSER_CertRecord); |
553 | cert->cert_type = ntohs (dcert.cert_type); | 553 | cert->cert_type = ntohs (dcert.cert_type); |
@@ -555,7 +555,7 @@ GNUNET_DNSPARSER_parse_cert (const char *udp_payload, | |||
555 | cert->algorithm = dcert.algorithm; | 555 | cert->algorithm = dcert.algorithm; |
556 | cert->certificate_size = udp_payload_length - (*off); | 556 | cert->certificate_size = udp_payload_length - (*off); |
557 | cert->certificate_data = GNUNET_malloc (cert->certificate_size); | 557 | cert->certificate_data = GNUNET_malloc (cert->certificate_size); |
558 | memcpy (cert->certificate_data, | 558 | GNUNET_memcpy (cert->certificate_data, |
559 | &udp_payload[*off], | 559 | &udp_payload[*off], |
560 | cert->certificate_size); | 560 | cert->certificate_size); |
561 | (*off) += cert->certificate_size; | 561 | (*off) += cert->certificate_size; |
@@ -598,7 +598,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload, | |||
598 | GNUNET_break_op (0); | 598 | GNUNET_break_op (0); |
599 | return GNUNET_SYSERR; | 599 | return GNUNET_SYSERR; |
600 | } | 600 | } |
601 | memcpy (&rl, &udp_payload[*off], sizeof (rl)); | 601 | GNUNET_memcpy (&rl, &udp_payload[*off], sizeof (rl)); |
602 | (*off) += sizeof (rl); | 602 | (*off) += sizeof (rl); |
603 | r->type = ntohs (rl.type); | 603 | r->type = ntohs (rl.type); |
604 | r->dns_traffic_class = ntohs (rl.dns_traffic_class); | 604 | r->dns_traffic_class = ntohs (rl.dns_traffic_class); |
@@ -659,7 +659,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload, | |||
659 | default: | 659 | default: |
660 | r->data.raw.data = GNUNET_malloc (data_len); | 660 | r->data.raw.data = GNUNET_malloc (data_len); |
661 | r->data.raw.data_len = data_len; | 661 | r->data.raw.data_len = data_len; |
662 | memcpy (r->data.raw.data, &udp_payload[*off], data_len); | 662 | GNUNET_memcpy (r->data.raw.data, &udp_payload[*off], data_len); |
663 | break; | 663 | break; |
664 | } | 664 | } |
665 | (*off) += data_len; | 665 | (*off) += data_len; |
@@ -838,7 +838,7 @@ GNUNET_DNSPARSER_builder_add_name (char *dst, | |||
838 | goto fail; /* segment too long or empty */ | 838 | goto fail; /* segment too long or empty */ |
839 | } | 839 | } |
840 | dst[pos++] = (char) (uint8_t) len; | 840 | dst[pos++] = (char) (uint8_t) len; |
841 | memcpy (&dst[pos], idna_name, len); | 841 | GNUNET_memcpy (&dst[pos], idna_name, len); |
842 | pos += len; | 842 | pos += len; |
843 | idna_name += len + 1; /* also skip dot */ | 843 | idna_name += len + 1; /* also skip dot */ |
844 | } | 844 | } |
@@ -887,7 +887,7 @@ GNUNET_DNSPARSER_builder_add_query (char *dst, | |||
887 | return ret; | 887 | return ret; |
888 | ql.type = htons (query->type); | 888 | ql.type = htons (query->type); |
889 | ql.dns_traffic_class = htons (query->dns_traffic_class); | 889 | ql.dns_traffic_class = htons (query->dns_traffic_class); |
890 | memcpy (&dst[*off], &ql, sizeof (ql)); | 890 | GNUNET_memcpy (&dst[*off], &ql, sizeof (ql)); |
891 | (*off) += sizeof (ql); | 891 | (*off) += sizeof (ql); |
892 | return GNUNET_OK; | 892 | return GNUNET_OK; |
893 | } | 893 | } |
@@ -916,7 +916,7 @@ GNUNET_DNSPARSER_builder_add_mx (char *dst, | |||
916 | if (*off + sizeof (uint16_t) > dst_len) | 916 | if (*off + sizeof (uint16_t) > dst_len) |
917 | return GNUNET_NO; | 917 | return GNUNET_NO; |
918 | mxpref = htons (mx->preference); | 918 | mxpref = htons (mx->preference); |
919 | memcpy (&dst[*off], &mxpref, sizeof (mxpref)); | 919 | GNUNET_memcpy (&dst[*off], &mxpref, sizeof (mxpref)); |
920 | (*off) += sizeof (mxpref); | 920 | (*off) += sizeof (mxpref); |
921 | return GNUNET_DNSPARSER_builder_add_name (dst, dst_len, off, mx->mxhost); | 921 | return GNUNET_DNSPARSER_builder_add_name (dst, dst_len, off, mx->mxhost); |
922 | } | 922 | } |
@@ -954,9 +954,9 @@ GNUNET_DNSPARSER_builder_add_cert (char *dst, | |||
954 | dcert.cert_type = htons ((uint16_t) cert->cert_type); | 954 | dcert.cert_type = htons ((uint16_t) cert->cert_type); |
955 | dcert.cert_tag = htons ((uint16_t) cert->cert_tag); | 955 | dcert.cert_tag = htons ((uint16_t) cert->cert_tag); |
956 | dcert.algorithm = (uint8_t) cert->algorithm; | 956 | dcert.algorithm = (uint8_t) cert->algorithm; |
957 | memcpy (&dst[*off], &dcert, sizeof (dcert)); | 957 | GNUNET_memcpy (&dst[*off], &dcert, sizeof (dcert)); |
958 | (*off) += sizeof (dcert); | 958 | (*off) += sizeof (dcert); |
959 | memcpy (&dst[*off], cert->certificate_data, cert->certificate_size); | 959 | GNUNET_memcpy (&dst[*off], cert->certificate_data, cert->certificate_size); |
960 | (*off) += cert->certificate_size; | 960 | (*off) += cert->certificate_size; |
961 | return GNUNET_OK; | 961 | return GNUNET_OK; |
962 | } | 962 | } |
@@ -999,7 +999,7 @@ GNUNET_DNSPARSER_builder_add_soa (char *dst, | |||
999 | sd.retry = htonl (soa->retry); | 999 | sd.retry = htonl (soa->retry); |
1000 | sd.expire = htonl (soa->expire); | 1000 | sd.expire = htonl (soa->expire); |
1001 | sd.minimum = htonl (soa->minimum_ttl); | 1001 | sd.minimum = htonl (soa->minimum_ttl); |
1002 | memcpy (&dst[*off], &sd, sizeof (sd)); | 1002 | GNUNET_memcpy (&dst[*off], &sd, sizeof (sd)); |
1003 | (*off) += sizeof (sd); | 1003 | (*off) += sizeof (sd); |
1004 | return GNUNET_OK; | 1004 | return GNUNET_OK; |
1005 | } | 1005 | } |
@@ -1031,7 +1031,7 @@ GNUNET_DNSPARSER_builder_add_srv (char *dst, | |||
1031 | sd.prio = htons (srv->priority); | 1031 | sd.prio = htons (srv->priority); |
1032 | sd.weight = htons (srv->weight); | 1032 | sd.weight = htons (srv->weight); |
1033 | sd.port = htons (srv->port); | 1033 | sd.port = htons (srv->port); |
1034 | memcpy (&dst[*off], &sd, sizeof (sd)); | 1034 | GNUNET_memcpy (&dst[*off], &sd, sizeof (sd)); |
1035 | (*off) += sizeof (sd); | 1035 | (*off) += sizeof (sd); |
1036 | if (GNUNET_OK != (ret = GNUNET_DNSPARSER_builder_add_name (dst, | 1036 | if (GNUNET_OK != (ret = GNUNET_DNSPARSER_builder_add_name (dst, |
1037 | dst_len, | 1037 | dst_len, |
@@ -1100,7 +1100,7 @@ add_record (char *dst, | |||
1100 | ret = GNUNET_NO; | 1100 | ret = GNUNET_NO; |
1101 | break; | 1101 | break; |
1102 | } | 1102 | } |
1103 | memcpy (&dst[pos], record->data.raw.data, record->data.raw.data_len); | 1103 | GNUNET_memcpy (&dst[pos], record->data.raw.data, record->data.raw.data_len); |
1104 | pos += record->data.raw.data_len; | 1104 | pos += record->data.raw.data_len; |
1105 | ret = GNUNET_OK; | 1105 | ret = GNUNET_OK; |
1106 | break; | 1106 | break; |
@@ -1121,7 +1121,7 @@ add_record (char *dst, | |||
1121 | rl.dns_traffic_class = htons (record->dns_traffic_class); | 1121 | rl.dns_traffic_class = htons (record->dns_traffic_class); |
1122 | rl.ttl = htonl (GNUNET_TIME_absolute_get_remaining (record->expiration_time).rel_value_us / 1000LL / 1000LL); /* in seconds */ | 1122 | rl.ttl = htonl (GNUNET_TIME_absolute_get_remaining (record->expiration_time).rel_value_us / 1000LL / 1000LL); /* in seconds */ |
1123 | rl.data_len = htons ((uint16_t) (pos - (*off + sizeof (struct GNUNET_TUN_DnsRecordLine)))); | 1123 | rl.data_len = htons ((uint16_t) (pos - (*off + sizeof (struct GNUNET_TUN_DnsRecordLine)))); |
1124 | memcpy (&dst[*off], &rl, sizeof (struct GNUNET_TUN_DnsRecordLine)); | 1124 | GNUNET_memcpy (&dst[*off], &rl, sizeof (struct GNUNET_TUN_DnsRecordLine)); |
1125 | *off = pos; | 1125 | *off = pos; |
1126 | return GNUNET_OK; | 1126 | return GNUNET_OK; |
1127 | } | 1127 | } |
@@ -1219,11 +1219,11 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, | |||
1219 | 1219 | ||
1220 | if (GNUNET_YES == trc) | 1220 | if (GNUNET_YES == trc) |
1221 | dns.flags.message_truncated = 1; | 1221 | dns.flags.message_truncated = 1; |
1222 | memcpy (tmp, &dns, sizeof (struct GNUNET_TUN_DnsHeader)); | 1222 | GNUNET_memcpy (tmp, &dns, sizeof (struct GNUNET_TUN_DnsHeader)); |
1223 | 1223 | ||
1224 | *buf = GNUNET_malloc (off); | 1224 | *buf = GNUNET_malloc (off); |
1225 | *buf_length = off; | 1225 | *buf_length = off; |
1226 | memcpy (*buf, tmp, off); | 1226 | GNUNET_memcpy (*buf, tmp, off); |
1227 | if (GNUNET_YES == trc) | 1227 | if (GNUNET_YES == trc) |
1228 | return GNUNET_NO; | 1228 | return GNUNET_NO; |
1229 | return GNUNET_OK; | 1229 | return GNUNET_OK; |