Bug 829 - doc of sldns_wire2str_rdata_buf() return value has an off-by-one typo
doc of sldns_wire2str_rdata_buf() return value has an off-by-one typo
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
unspecified
Other All
: P5 enhancement
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-09-02 18:48 CEST by JINMEI Tatuya
Modified: 2016-09-05 09:16 CEST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JINMEI Tatuya 2016-09-02 18:48:46 CEST
In sldns/wire2str.h, the description of sldns_wire2str_type_buf() says:

 * @return the number of characters for this element, excluding zerobyte.
 * 	Is larger than str_len if output was truncated.

This is slightly incorrect.  In fact it can also return 'str_len' when
truncation happens.  No truncation is ensured only when @return < 'str_len'.

I suspect the description of some other of '2str' functions have the same error.
Comment 1 Wouter Wijngaards 2016-09-05 09:16:20 CEST
Hi Jinmei,

Thank you for the report.

I have changed it so 'larger or equal' in the text.  I hope it is then correct, you are right it needs unused space in the buffer to ensure it was not truncated.

(also changed for the other occurrences of this text in the header file).

Best regards, Wouter