From 0030d4216cda0062baf7f9047bb524eebfaaf1ad Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 13 Sep 2016 20:52:58 +0200 Subject: [PATCH] =?utf8?q?regex=20match:=20snprintf=20=E2=86=92=20ssnprint?= =?utf8?q?f?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ssnprintf() ensures null termination, which is especially important when using "%s" in the format. --- src/match_regex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.30.2