Skip to content

Commit

Permalink
Fix b32 routine.
Browse files Browse the repository at this point in the history
  • Loading branch information
wcawijngaards committed Aug 11, 2010
1 parent 251cfa2 commit 3901385
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compat/b32_ntop.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ ldns_b32_ntop_ar(uint8_t const *src, size_t srclength, char *target, size_t targ
target[datalength++] = Pad32;
}
if (datalength+1 > targsize) {
return (-3);
return (int) (datalength);
}
target[datalength] = '\0'; /* Returned value doesn't count \0. */
return (int) (datalength);
Expand Down
2 changes: 1 addition & 1 deletion dnssec.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ ldns_nsec3_hash_name(ldns_rdf *name,
(uint8_t *) hashed_owner_str,
hashed_owner_str_len,
hashed_owner_b32,
ldns_b32_ntop_calculate_size(hashed_owner_str_len));
ldns_b32_ntop_calculate_size(hashed_owner_str_len)+1);
if (hashed_owner_b32_len < 1) {
fprintf(stderr, "Error in base32 extended hex encoding ");
fprintf(stderr, "of hashed owner name (name: ");
Expand Down
4 changes: 3 additions & 1 deletion host2str.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,13 @@ ldns_rdf2buffer_str_b32_ext(ldns_buffer *output, const ldns_rdf *rdf)
char *b32;
if(ldns_rdf_size(rdf) == 0)
return LDNS_STATUS_OK;
/* remove -1 for the b32-hash-len octet */
size = ldns_b32_ntop_calculate_size(ldns_rdf_size(rdf) - 1);
/* add one for the end nul for the string */
b32 = LDNS_XMALLOC(char, size + 1);
if(!b32) return LDNS_STATUS_MEM_ERR;
size = (size_t) ldns_b32_ntop_extended_hex(ldns_rdf_data(rdf) + 1,
ldns_rdf_size(rdf) - 1, b32, size);
ldns_rdf_size(rdf) - 1, b32, size+1);
if (size > 0) {
ldns_buffer_printf(output, "%s", b32);
}
Expand Down

0 comments on commit 3901385

Please sign in to comment.