NLnetLabs / ldns

LDNS is a DNS library that facilitates DNS tool programming
https://nlnetlabs.nl/ldns
BSD 3-Clause "New" or "Revised" License
301 stars 99 forks source link

Clear analysis warning for ldns_duration2string and truncation (GH #73) #90

Closed noloader closed 4 years ago

noloader commented 4 years ago

Analysis on 32-bit Ubuntu 18.04 is flagging the buffer used in ldns_duration2string. The buffer is about 6 chars too small for data in the range of the unsigned type.

noloader commented 4 years ago

I believe the Unbound folks used the following in a similar situation:

char num[16];

Also see Unbound Issue 169 and Commit 348e246b6666.

wtoorop commented 4 years ago

Thanks, I find this function rather unreadable to be honest and will replace it with something easier to read/understand.