On 2015-06-10 19:13, Richard Hansen wrote:
> Rewrite most of scrub_for_print() to safely handle corner cases
> (negative return value from snprintf(), output buffer too small).

The code changes all look good. If you have the time though, could you 
add a new test case that checks for out-of-bounds writes? Hopefully that 
test will fail with the existing scrub_for_print() implementation and 
pass with your new implementation.

Reviewed-by: David Mandelberg <da...@mandelberg.org>

>
> 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(-)

-- 
David Eric Mandelberg / dseomn
http://david.mandelberg.org/

------------------------------------------------------------------------------
_______________________________________________
rpstir-devel mailing list
rpstir-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpstir-devel

Reply via email to