diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-06 23:52:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-06 23:52:35 +0000 |
commit | 0925fad2014e4910d44bb4d9d9681da4e6962e49 (patch) | |
tree | 0cb3ef059d9229a0e94514595d0d0ebabc6bbf40 /src/gnsrecord | |
parent | fcc26b1404b9b5519f6d74d280a2f8044ee92c36 (diff) | |
download | gnunet-0925fad2014e4910d44bb4d9d9681da4e6962e49.tar.gz gnunet-0925fad2014e4910d44bb4d9d9681da4e6962e49.zip |
fix use of %c for ints
Diffstat (limited to 'src/gnsrecord')
-rw-r--r-- | src/gnsrecord/plugin_gnsrecord_dns.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/src/gnsrecord/plugin_gnsrecord_dns.c b/src/gnsrecord/plugin_gnsrecord_dns.c index 2f14ba5a9..b52dee374 100644 --- a/src/gnsrecord/plugin_gnsrecord_dns.c +++ b/src/gnsrecord/plugin_gnsrecord_dns.c | |||
@@ -239,10 +239,10 @@ dns_value_to_string (void *cls, | |||
239 | return NULL; /* malformed */ | 239 | return NULL; /* malformed */ |
240 | tlsa = data; | 240 | tlsa = data; |
241 | if (0 == GNUNET_asprintf (&tlsa_str, | 241 | if (0 == GNUNET_asprintf (&tlsa_str, |
242 | "%c %c %c %s", | 242 | "%u %u %u %s", |
243 | tlsa->usage, | 243 | (unsigned int) tlsa->usage, |
244 | tlsa->selector, | 244 | (unsigned int) tlsa->selector, |
245 | tlsa->matching_type, | 245 | (unsigned int) tlsa->matching_type, |
246 | (const char *) &tlsa[1])) | 246 | (const char *) &tlsa[1])) |
247 | { | 247 | { |
248 | GNUNET_free (tlsa_str); | 248 | GNUNET_free (tlsa_str); |
@@ -599,22 +599,29 @@ dns_string_to_value (void *cls, | |||
599 | memcpy (*data, &value_aaaa, sizeof (value_aaaa)); | 599 | memcpy (*data, &value_aaaa, sizeof (value_aaaa)); |
600 | return GNUNET_OK; | 600 | return GNUNET_OK; |
601 | case GNUNET_DNSPARSER_TYPE_TLSA: | 601 | case GNUNET_DNSPARSER_TYPE_TLSA: |
602 | *data_size = sizeof (struct GNUNET_TUN_DnsTlsaRecord) + strlen (s) - 6; | ||
603 | *data = tlsa = GNUNET_malloc (*data_size); | ||
604 | if (4 != SSCANF (s, "%c %c %c %s", | ||
605 | &tlsa->usage, | ||
606 | &tlsa->selector, | ||
607 | &tlsa->matching_type, | ||
608 | (char*)&tlsa[1])) | ||
609 | { | 602 | { |
610 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 603 | unsigned int usage; |
611 | _("Unable to parse TLSA record string `%s'\n"), | 604 | unsigned int selector; |
612 | s); | 605 | unsigned int matching_type; |
613 | *data_size = 0; | 606 | |
614 | GNUNET_free (tlsa); | 607 | *data_size = sizeof (struct GNUNET_TUN_DnsTlsaRecord) + strlen (s) - 6; |
615 | return GNUNET_SYSERR; | 608 | *data = tlsa = GNUNET_malloc (*data_size); |
609 | if (4 != SSCANF (s, | ||
610 | "%u %u %u %s", | ||
611 | (char*)&tlsa[1])) | ||
612 | { | ||
613 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
614 | _("Unable to parse TLSA record string `%s'\n"), | ||
615 | s); | ||
616 | *data_size = 0; | ||
617 | GNUNET_free (tlsa); | ||
618 | return GNUNET_SYSERR; | ||
619 | } | ||
620 | tlsa->usage = (uint8_t) usage; | ||
621 | tlsa->selector = (uint8_t) selector; | ||
622 | tlsa->matching_type = (uint8_t) matching_type; | ||
623 | return GNUNET_OK; | ||
616 | } | 624 | } |
617 | return GNUNET_OK; | ||
618 | default: | 625 | default: |
619 | return GNUNET_SYSERR; | 626 | return GNUNET_SYSERR; |
620 | } | 627 | } |