From: Florian Forster Date: Tue, 13 Sep 2016 18:52:58 +0000 (+0200) Subject: regex match: snprintf → ssnprintf X-Git-Tag: collectd-5.7.0~97^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=0030d4216cda0062baf7f9047bb524eebfaaf1ad;p=collectd.git regex match: snprintf → ssnprintf ssnprintf() ensures null termination, which is especially important when using "%s" in the format. --- diff --git a/src/match_regex.c b/src/match_regex.c index 5c75a634..dd8319ea 100644 --- a/src/match_regex.c +++ b/src/match_regex.c @@ -250,7 +250,7 @@ static int mr_config_add_meta_regex (llist_t **meta, /* {{{ */ llist_append (*meta, entry); } - snprintf (buffer, sizeof (buffer), "%s `%s'", ci->key, meta_key); + ssnprintf (buffer, sizeof (buffer), "%s `%s'", ci->key, meta_key); /* Can't pass &entry->value into mr_add_regex, so copy in/out. */ re_head = entry->value; status = mr_add_regex (&re_head, ci->values[1].value.string, buffer);