From b8c0f10561b960603507209fc8a3cd1fd7bb25ec Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Wed, 29 May 2024 19:13:13 +0200 Subject: [PATCH 1/3] Fix: Prevent strcmp on NULL in CREATE_USER --- src/manage_sql.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manage_sql.c b/src/manage_sql.c index 1598be76c..d5e99e3d2 100644 --- a/src/manage_sql.c +++ b/src/manage_sql.c @@ -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 From b3174de336dd834a64d90355738fcebec2eb8520 Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Wed, 29 May 2024 19:24:11 +0200 Subject: [PATCH 2/3] Use simpler check in MODIFY_USER --- src/manage_sql.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/manage_sql.c b/src/manage_sql.c index d5e99e3d2..9d0780cbb 100644 --- a/src/manage_sql.c +++ b/src/manage_sql.c @@ -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 <= 0)) 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 From 891ba7bf7798a5ecee23ee2462b59f1c562214f5 Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Tue, 18 Jun 2024 19:02:19 +0200 Subject: [PATCH 3/3] Correct allowed_methods check --- src/manage_sql.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manage_sql.c b/src/manage_sql.c index 9d0780cbb..e576e5832 100644 --- a/src/manage_sql.c +++ b/src/manage_sql.c @@ -54745,7 +54745,7 @@ 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