Skip to content

Commit

Permalink
Merge pull request NLnetLabs#988 from dyunwei/master
Browse files Browse the repository at this point in the history
Fix NLnetLabs#981: dump_cache truncates large records.
  • Loading branch information
wcawijngaards authored Jan 9, 2024
2 parents 418eeb6 + eb7eb5c commit 9cd724c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion daemon/remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ ssl_print_text(RES* res, const char* text)
static int
ssl_print_vmsg(RES* ssl, const char* format, va_list args)
{
char msg[1024];
char msg[65535];
vsnprintf(msg, sizeof(msg), format, args);
return ssl_print_text(ssl, msg);
}
Expand Down
5 changes: 4 additions & 1 deletion util/data/packed_rrset.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ int packed_rr_to_string(struct ub_packed_rrset_key* rrset, size_t i,
struct packed_rrset_data* d = (struct packed_rrset_data*)rrset->
entry.data;
uint8_t rr[65535];
size_t wlen;
size_t rlen = rrset->rk.dname_len + 2 + 2 + 4 + d->rr_len[i];
time_t adjust = 0;
log_assert(dest_len > 0 && dest);
Expand All @@ -292,7 +293,9 @@ int packed_rr_to_string(struct ub_packed_rrset_key* rrset, size_t i,
sldns_write_uint32(rr+rrset->rk.dname_len+4,
(uint32_t)(d->rr_ttl[i]-adjust));
memmove(rr+rrset->rk.dname_len+8, d->rr_data[i], d->rr_len[i]);
if(sldns_wire2str_rr_buf(rr, rlen, dest, dest_len) == -1) {
wlen = (size_t)sldns_wire2str_rr_buf(rr, rlen, dest, dest_len);
if(wlen >= dest_len) {
/* the output string was truncated */
log_info("rrbuf failure %d %s", (int)d->rr_len[i], dest);
dest[0] = 0;
return 0;
Expand Down

0 comments on commit 9cd724c

Please sign in to comment.