Skip to content

Commit

Permalink
Merge pull request #2207 from greenbone/create-user-sources-segf
Browse files Browse the repository at this point in the history
Fix: Prevent strcmp on NULL in CREATE_USER
  • Loading branch information
a-h-abdelsalam authored Jun 19, 2024
2 parents 13fc5c8 + 891ba7b commit 453fa45
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -53682,7 +53682,7 @@ create_user (const gchar * name, const gchar * password, const gchar *comment,
if (allowed_methods && (allowed_methods->len > 2))
return -3;

if (allowed_methods && (allowed_methods->len == 0))
if (allowed_methods && (allowed_methods->len <= 1))
allowed_methods = NULL;

if (allowed_methods
Expand Down Expand Up @@ -54745,12 +54745,11 @@ modify_user (const gchar * user_id, gchar **name, const gchar *new_name,
if (allowed_methods && (allowed_methods->len > 2))
return -3;

if (allowed_methods && (allowed_methods->len == 0))
if (allowed_methods && (allowed_methods->len <= 1))
allowed_methods = NULL;

if (allowed_methods
&& ((g_ptr_array_index (allowed_methods, 0) == NULL)
|| (strlen (g_ptr_array_index (allowed_methods, 0)) == 0)))
&& (strlen (g_ptr_array_index (allowed_methods, 0)) == 0))
allowed_methods = NULL;

if (allowed_methods
Expand Down

0 comments on commit 453fa45

Please sign in to comment.