author | Marc Fournier <marc.fournier@camptocamp.com> | |
Tue, 9 Feb 2016 22:13:15 +0000 (23:13 +0100) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Tue, 9 Feb 2016 22:13:15 +0000 (23:13 +0100) |
write_sensu: avoid calling strlen() on variable set to NULL
src/write_sensu.c | patch | blob | history |
diff --git a/src/write_sensu.c b/src/write_sensu.c
index 507018fdd1f6a7688a0672679fdcd63628d58fe3..4d0e473757174e7bdf79b9662bbd258fa049355f 100644 (file)
--- a/src/write_sensu.c
+++ b/src/write_sensu.c
}
// incorporate sensu tags from config if any
- if (strlen(sensu_tags) != 0) {
+ if ((sensu_tags != NULL) && (strlen(sensu_tags) != 0)) {
res = asprintf(&temp_str, "%s, %s", ret_str, sensu_tags);
free(ret_str);
if (res == -1) {
}
// incorporate sensu tags from config if any
- if (strlen(sensu_tags) != 0) {
+ if ((sensu_tags != NULL) && (strlen(sensu_tags) != 0)) {
res = asprintf(&temp_str, "%s, %s", ret_str, sensu_tags);
free(ret_str);
if (res == -1) {