From 2a7e18558ffd732901f88bde0d0904d78e6db90e Mon Sep 17 00:00:00 2001 From: Jan-Oliver Wagner Date: Thu, 6 Jun 2019 21:18:57 +0200 Subject: [PATCH] Prevent g_strsplit to be called with NULL. There might be situations where ref_ids is NULL, so return an error instead of handing it over to g_strsplit() which will bail out via assert(). --- base/nvti.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/base/nvti.c b/base/nvti.c index b3905db98..dfc8feae9 100644 --- a/base/nvti.c +++ b/base/nvti.c @@ -957,7 +957,7 @@ nvti_set_category (nvti_t *n, const gint category) * * @param ref_text The optional text accompanying all references. * - * @return 0 for success. 1 if n was NULL. + * @return 0 for success. 1 if n was NULL, 2 if ref_ids was NULL. */ int nvti_add_refs (nvti_t *n, const gchar *type, const gchar *ref_ids, @@ -968,6 +968,9 @@ nvti_add_refs (nvti_t *n, const gchar *type, const gchar *ref_ids, if (!n) return (1); + if (!ref_ids) + return (2); + split = g_strsplit (ref_ids, ",", 0); for (item = split; *item; item++)