---
 lib/util/stringutils.c |  4 ++++
 lib/util/stringutils.h | 12 ++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/util/stringutils.c b/lib/util/stringutils.c
index 642ff68..6e15226 100644
--- a/lib/util/stringutils.c
+++ b/lib/util/stringutils.c
@@ -328,6 +328,10 @@ char *scrub_for_print(
         }
 
         int ret = snprintf(&dst[used], dst_sz - used, fmt, src[i]);
+        if (ret < 0)
+        {
+            return NULL;
+        }
         len_out += ret;
         used += ((size_t)ret > (dst_sz - used)) ? (dst_sz - used) : 
(size_t)ret;
     }
diff --git a/lib/util/stringutils.h b/lib/util/stringutils.h
index 154b54f..6db8663 100644
--- a/lib/util/stringutils.h
+++ b/lib/util/stringutils.h
@@ -152,16 +152,16 @@ int expand_by_doubling(
  * @param[in] dst_sz
  *     Size of the buffer at @p dst.  This must not be 0.
  * @param[out] dst_len_out
- *     On return, the value at this location will be set to the length
- *     of the escaped string (excluding the nul terminator), had @p
- *     dst_sz been big enough.  If this value is greater than or equal
- *     to @p dst_sz, then the output was truncated.  This parameter
- *     may be NULL.
+ *     On successful return, the value at this location will be set to
+ *     the length of the escaped string (excluding the nul terminator)
+ *     had @p dst_sz been big enough.  If this value is greater than
+ *     or equal to @p dst_sz, then the output was truncated.  This
+ *     parameter may be NULL.
  * @param[in] other_chars_to_escape
  *     nul-terminated array of additional characters to escape with a
  *     backslash.  This may be NULL.
  *
- * @return dst
+ * @return dst on success, NULL on error
 
------------------------------------------------------------------------------*/
 char *scrub_for_print(
     char *dst,
-- 
2.4.3


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

Reply via email to