Skip to content

Commit d83553a

Browse files
noctrexDeusData
authored andcommitted
fix(store.c): improve root path integrity check with range-based validation
Replace the fragile NOT IN list of individual characters with a range-based BETWEEN 'A' AND 'Z' check for validating project root paths. The previous query only excluded letters A–H, leaving paths starting with I–Z silently invalid. In Windows, all the alphabet can be used. A Windows drive starting with letters I-Z breaks the saving of the database.
1 parent eca433b commit d83553a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/store/store.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,8 @@ bool cbm_store_check_integrity(cbm_store_t *s) {
657657
rc = sqlite3_prepare_v2(
658658
s->db,
659659
"SELECT root_path FROM projects WHERE root_path != '' "
660-
"AND substr(root_path, 1, 1) NOT IN ('/', 'A','B','C','D','E','F','G','H') LIMIT 1;",
660+
"AND NOT (substr(root_path, 1, 1) = '/' "
661+
"OR (substr(root_path, 1, 1) BETWEEN 'A' AND 'Z')) LIMIT 1;",
661662
CBM_NOT_FOUND, &stmt, NULL);
662663
if (rc == SQLITE_OK) {
663664
if (sqlite3_step(stmt) == SQLITE_ROW) {

0 commit comments

Comments
 (0)