projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e37293e
)
set target: Avoid casting negative int to size_t.
author
Florian Forster
<octo@collectd.org>
Fri, 16 Dec 2016 17:38:34 +0000
(18:38 +0100)
committer
Florian Forster
<octo@collectd.org>
Fri, 16 Dec 2016 17:38:34 +0000
(18:38 +0100)
CID: 157643
src/target_set.c
patch
|
blob
|
history
diff --git
a/src/target_set.c
b/src/target_set.c
index
7d54c93
..
a40273c
100644
(file)
--- 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;