Rewrite most of scrub_for_print() to safely handle corner cases (negative return value from snprintf(), output buffer too small).
Richard Hansen (13): whitespace fixes add missing #include guard in lib/util/stringutils.h include stringutils.h file before other headers add missing #include move function documentation to function declaration document scrub_for_print() parameters and return value add tests for scrub_for_print()'s output length factor out nearly-identical snprintf() calls in scrub_for_print() allow NULL for scrub_for_print()'s other_chars_to_escape param fix scrub_for_print()'s for loop condition fix scrub_for_print() when output buffer is too small fix scrub_for_print() when snprintf() fails allow dst==NULL and dst_sz==0 for scrub_for_print() lib/util/stringutils.c | 147 +++++++++----------------------------- lib/util/stringutils.h | 126 +++++++++++++++++++++++++++++++- lib/util/tests/stringutils-test.c | 24 +++++-- 3 files changed, 176 insertions(+), 121 deletions(-) -- 2.4.3 ------------------------------------------------------------------------------ _______________________________________________ rpstir-devel mailing list rpstir-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpstir-devel