summaryrefslogtreecommitdiffstats
path: root/collection
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2012-12-23 13:49:56 -0500
committerOndrej Kos <okos@redhat.com>2013-01-24 08:34:40 +0100
commit833a46e384828be48c27898e755d6215eb5c4bb8 (patch)
treeeaf34cd463381efc40991151d41d9deec295f704 /collection
parent57faa64667411a3d8eeeeff62b1e659a94ed29cf (diff)
downloadding-libs2-833a46e384828be48c27898e755d6215eb5c4bb8.tar.gz
ding-libs2-833a46e384828be48c27898e755d6215eb5c4bb8.tar.xz
ding-libs2-833a46e384828be48c27898e755d6215eb5c4bb8.zip
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.
Diffstat (limited to 'collection')
-rw-r--r--collection/collection_tools.c5
1 files changed, 5 insertions, 0 deletions
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++)