[Bug 3534] probable underflow calculating display width of file name

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Mon Feb 20 14:35:08 AEDT 2023


https://bugzilla.mindrot.org/show_bug.cgi?id=3534

--- Comment #15 from Damien Miller <djm at mindrot.org> ---
(In reply to Darren Tucker from comment #14)
> Comment on attachment 3679 [details]
> different approach
> 
> Looks ok with a couple of nits.
> 
> >+	static char buf[((sizeof(off_t) * 8 * 4 * 2) / 10) + 16];
> 
> What's the reasoning behind the numbers?

calculating the length of integer rendered as a string using
nbits*log2(10) / 10

8 bits per byte
4 > 3.321 ~= log2(10)
2 because there are two variables being formatted

-- 
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list