From ac9e71d9c751552951a10b20b3e9b4b0c89cde9b Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 20 Feb 2024 13:25:24 +0200 Subject: [PATCH] LibC: Fix parsing mode from string --- libc/stdio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/stdio.cpp b/libc/stdio.cpp index 76a81f7d..d91d30ff 100644 --- a/libc/stdio.cpp +++ b/libc/stdio.cpp @@ -81,7 +81,7 @@ static mode_t parse_mode_string(const char* mode_str) return 0; if (len == 3 && mode_str[1] == mode_str[2]) return 0; - if (strcspn(mode_str + 1, "b+") != len - 1) + if (strspn(mode_str + 1, "b+") != len - 1) return 0; bool plus = (mode_str[1] == '+' || mode_str[2] == '+'); switch (mode_str[0])