Skip to content

Commit 4c2e74d

Browse files
committed
Fix switch fallthrough: return false before #ifndef _WIN32 backslash case
1 parent 8f56f3d commit 4c2e74d

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/foundation/str_util.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ bool cbm_validate_shell_arg(const char *s) {
249249
case '`':
250250
case '\n':
251251
case '\r':
252+
return false;
252253
#ifndef _WIN32
253254
case '\\':
254255
return false;

tests/test_str_util.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,12 @@ TEST(validate_shell_arg_carriage_return) {
405405
}
406406

407407
TEST(validate_shell_arg_backslash) {
408+
#ifdef _WIN32
409+
/* Backslash is allowed on Windows (path separator) */
410+
ASSERT_TRUE(cbm_validate_shell_arg("path\\to\\file"));
411+
#else
408412
ASSERT_FALSE(cbm_validate_shell_arg("path\\to\\file"));
413+
#endif
409414
PASS();
410415
}
411416

0 commit comments

Comments
 (0)