Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent g_strsplit to be called with NULL. #238

Merged
merged 1 commit into from
Jun 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion base/nvti.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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++)
Expand Down