On Tue, May 01, 2018 at 12:54:12PM -0500, Derek Martin wrote: > On Tue, May 01, 2018 at 11:59:27AM -0500, Derek Martin wrote: > > FWIW, I've said this before, but I think anywhere strncpy() is used, > > code that does the above should replace it. This avoids silent > > truncation (which strncpy() does), and checking the return is required > > to make sure snprintf() actually did something, and you're not > > operating on uninitialized memory (or whatever). > > Sorry, this was badly worded. Checking the return value is required > to ensure that snprintf() wrote all the data (rc < size, NOT <= size), > assuming you want that. If you actually want it to silently truncate, > which you may if for example you're formatting the index, then you can > ignore it. That may or may not cause an error if compiled with -Wall > -Werror flags... the glibc folks have been doing a lot of that lately.
Hi Derek, I haven't forgotten or ignored your past emails, and this is still on my list. I've been thinking about a couple ways to deal with this, that I'll try after this release. The nice thing about the static buffers is the speed, but I've been thinking of allocating a pool of BUFFER of various sizes and using that for the critical parts of the code. -- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA
signature.asc
Description: PGP signature