summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: acb5a33)
raw | patch | inline | side by side (parent: acb5a33)
author | Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com> | |
Mon, 6 Feb 2017 11:28:33 +0000 (11:28 +0000) | ||
committer | Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com> | |
Mon, 6 Feb 2017 11:57:16 +0000 (11:57 +0000) |
If python pugin reads and writes collectd values, the write python
plugin callback may crash (90%) on free table var (line 478) if the
meta data structure is created but no information is present there.
It's possible to reproduce it due to changes introduced by #2135 PR.
cpy_write_callback():
...
425 if (value_list->meta) {
426 char **table;
427 meta_data_t *meta = value_list->meta;
428
429 int num = meta_data_toc(meta, &table);
430 for (int i = 0; i < num; ++i) {
...
477 }
478 free(table);
479 }
Change-Id: Ic897933f447b9280f266b6e78b6b73bd12182eba
Signed-off-by: Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com>
plugin callback may crash (90%) on free table var (line 478) if the
meta data structure is created but no information is present there.
It's possible to reproduce it due to changes introduced by #2135 PR.
cpy_write_callback():
...
425 if (value_list->meta) {
426 char **table;
427 meta_data_t *meta = value_list->meta;
428
429 int num = meta_data_toc(meta, &table);
430 for (int i = 0; i < num; ++i) {
...
477 }
478 free(table);
479 }
Change-Id: Ic897933f447b9280f266b6e78b6b73bd12182eba
Signed-off-by: Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com>
src/python.c | patch | blob | history | |
src/pyvalues.c | patch | blob | history |
diff --git a/src/python.c b/src/python.c
index d4efa94d42a50926a3e0f051660581f3ca3df13f..a8f5177f7b6bdaa82a234fa0006e51372cd7b487 100644 (file)
--- a/src/python.c
+++ b/src/python.c
}
dict = PyDict_New(); /* New reference. */
if (value_list->meta) {
- char **table;
+ char **table = NULL;
meta_data_t *meta = value_list->meta;
int num = meta_data_toc(meta, &table);
diff --git a/src/pyvalues.c b/src/pyvalues.c
index 9c8809da497b704d0fcb66c4361e0d556c420910..5dcdf6a22a10e0309a2d550c39636e4ea059a653 100644 (file)
--- a/src/pyvalues.c
+++ b/src/pyvalues.c
static meta_data_t *cpy_build_value_meta(PyObject *meta) {
meta_data_t *m = meta_data_create();
- cpy_build_meta(meta, &cpy_meta_data, (void *)m);
+ if (cpy_build_meta(meta, &cpy_meta_data, (void *)m) < 0) {
+ meta_data_destroy(m);
+ return NULL;
+ }
return m;
}