Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Fix switch fallthrough: return false before #ifndef _WIN32 backslash case

Martin Vogel4c2e74dc999a
diff --git a/src/foundation/str_util.c b/src/foundation/str_util.c
index 6c0337d64..b6fdbdb40 100644
--- a/src/foundation/str_util.c
+++ b/src/foundation/str_util.c
@@ -249,6 +249,7 @@ bool cbm_validate_shell_arg(const char *s) {
case '`':
case '\n':
case '\r':
+ return false;
#ifndef _WIN32
case '\\':
return false;
diff --git a/tests/test_str_util.c b/tests/test_str_util.c
index 7f925a085..d153a0987 100644
--- a/tests/test_str_util.c
+++ b/tests/test_str_util.c
@@ -405,7 +405,12 @@ TEST(validate_shell_arg_carriage_return) {
}
TEST(validate_shell_arg_backslash) {
+#ifdef _WIN32
+ /* Backslash is allowed on Windows (path separator) */
+ ASSERT_TRUE(cbm_validate_shell_arg("path\\to\\file"));
+#else
ASSERT_FALSE(cbm_validate_shell_arg("path\\to\\file"));
+#endif
PASS();
}