From 833a46e384828be48c27898e755d6215eb5c4bb8 Mon Sep 17 00:00:00 2001 From: Dmitri Pal Date: Sun, 23 Dec 2012 13:49:56 -0500 Subject: Replacing sprintf with snprintf Replaced sprintf in the unit test. Defined constants for sizes and used them. Wrpapped lines where noticed that they are longer than 80. Added comments to the places where sprintf is still used but it is safe to use. --- collection/collection_tools.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'collection/collection_tools.c') diff --git a/collection/collection_tools.c b/collection/collection_tools.c index 54d96c3..7e60285 100644 --- a/collection/collection_tools.c +++ b/collection/collection_tools.c @@ -465,6 +465,11 @@ int col_serialize(const char *property_in, (const char *)(data), '"'); break; + /* Here and below it is safe to use sprintf() becuase we + * already pre-calculated the length and allocated buffer + * of the right size. + */ + case COL_TYPE_BINARY: buf_data->buffer[buf_data->length] = '\''; for (i = 0; i < length; i++) -- cgit