Skip to content

Commit ef9b425

Browse files
victoryforceTurboGit
authored andcommitted
Escape the path that we pass to the SQLite query
1 parent eea7ac5 commit ef9b425

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libs/collect.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ static void view_popup_menu_onRemove(GtkWidget *menuitem,
536536
gchar *fullq = NULL;
537537

538538
gtk_tree_model_get(model, &iter, DT_LIB_COLLECT_COL_PATH, &filmroll_path, -1);
539+
char *escaped_filmroll_path = sqlite3_mprintf("%q", filmroll_path);
539540

540541
/* Clean selected images, and add to the table those which are going to be deleted */
541542
DT_DEBUG_SQLITE3_EXEC(dt_database_get(darktable.db),
@@ -547,11 +548,12 @@ static void view_popup_menu_onRemove(GtkWidget *menuitem,
547548
" SELECT id"
548549
" FROM main.images"
549550
" WHERE film_id IN (SELECT id FROM main.film_rolls WHERE folder LIKE '%s%%')",
550-
filmroll_path);
551+
escaped_filmroll_path);
551552
// clang-format on
552553

553554
DT_DEBUG_SQLITE3_EXEC(dt_database_get(darktable.db), fullq, NULL, NULL, NULL);
554555
g_free(filmroll_path);
556+
sqlite3_free(escaped_filmroll_path);
555557

556558
if(dt_control_remove_images())
557559
{

0 commit comments

Comments
 (0)