From 10978c59e429c92f46188c55ded7a36dfd757c35 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Sun, 17 Sep 2023 11:32:56 +0200 Subject: [PATCH] Made custom worker names safe for JSON data And comma-separated lists too. --- src/stratum_server.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stratum_server.cpp b/src/stratum_server.cpp index 97c51c5..f460e82 100644 --- a/src/stratum_server.cpp +++ b/src/stratum_server.cpp @@ -197,8 +197,8 @@ static bool get_custom_user(const char* s, char (&user)[N]) if ((c == '+') || (c == '.')) { break; } - // Limit to printable ASCII characters - if (c >= ' ' && c <= '~') { + // Limit to printable ASCII characters, also skip comma and JSON special characters + if (c >= ' ' && c <= '~' && c != ',' && c != '"' && c != '\\') { user[len++] = c; } ++s;