From 55c1bf4105459ff39906f108aa8ad3f99cc0504b Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 16 Dec 2016 18:38:34 +0100 Subject: [PATCH] set target: Avoid casting negative int to size_t. CID: 157643 --- src/target_set.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/target_set.c b/src/target_set.c index 7d54c93b..a40273c0 100644 --- a/src/target_set.c +++ b/src/target_set.c @@ -183,8 +183,11 @@ static void ts_subst(char *dest, size_t size, const char *string, /* {{{ */ REPLACE_FIELD("%{type_instance}", vl->type_instance); if (vl->meta != NULL) { - char **meta_toc; + char **meta_toc = NULL; int meta_entries = meta_data_toc(vl->meta, &meta_toc); + if (meta_entries <= 0) + return; + for (int i = 0; i < meta_entries; i++) { char meta_name[DATA_MAX_NAME_LEN]; char *value_str; -- 2.30.2