From 496ca2b758344bc6372ab0adf98ad8050f69b25a Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 6 Aug 2016 20:15:51 +0200 Subject: [PATCH] src/utils_db_query.c: Check return status of strjoin(). Fixes: #4 --- src/utils_db_query.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/utils_db_query.c b/src/utils_db_query.c index 6b3c056c..9a168739 100644 --- a/src/utils_db_query.c +++ b/src/utils_db_query.c @@ -236,15 +236,27 @@ static int udb_result_submit (udb_result_t *r, /* {{{ */ { if (r->instance_prefix == NULL) { - strjoin (vl.type_instance, sizeof (vl.type_instance), + int status = strjoin (vl.type_instance, sizeof (vl.type_instance), r_area->instances_buffer, r->instances_num, "-"); + if (status != 0) + { + ERROR ("udb_result_submit: creating type_instance failed with status %d.", + status); + return (status); + } } else { char tmp[DATA_MAX_NAME_LEN]; - strjoin (tmp, sizeof (tmp), r_area->instances_buffer, + int status = strjoin (tmp, sizeof (tmp), r_area->instances_buffer, r->instances_num, "-"); + if (status != 0) + { + ERROR ("udb_result_submit: creating type_instance failed with status %d.", + status); + return (status); + } tmp[sizeof (tmp) - 1] = 0; snprintf (vl.type_instance, sizeof (vl.type_instance), "%s-%s", -- 2.30.2