Description
The compiler flagged a number of potential errors with the use of strncpy(), which have been fixed with #283.
However, there might be other such errors.
Also, null-terminated strings could introduce obscure bugs if any strings have embedded nulls (unlikely, but possible).
And the current code does its own buffer handling, re-allocating the buffers if needed when appending.
A better solution is to use std::string
-- it handles buffer reallocation and also can handle nulls within strings.
Making this change would reduce the amount of code somewhat, which would reduce the probability of errors.
It would also probably help to change functions that pass char*
parameters or return char*
values (or update char**
parameters). For public APIs, the existing char*
ones could be preserved by adding equivalent std::string
or const std::string&
APIs.
If you wish some help with making these changes, please ask.