From 1450681fb47da3b8268c844c70c5df940843ed75 Mon Sep 17 00:00:00 2001 From: Denis Collette Date: Wed, 22 Jan 2020 19:40:26 -0400 Subject: [PATCH 1/3] Problem: Issue #3766 states that strtok is not thread safe and should be replaced Solution: Replaced calls to strtok with strtok_r (strtok_s for windows) in ws_engine.cpp --- src/ws_engine.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ws_engine.cpp b/src/ws_engine.cpp index fc4b1721..25c5a20d 100644 --- a/src/ws_engine.cpp +++ b/src/ws_engine.cpp @@ -73,6 +73,7 @@ along with this program. If not, see . #ifdef ZMQ_HAVE_WINDOWS #define strcasecmp _stricmp +#define strtok_r strtok_s #else #ifdef ZMQ_HAVE_LIBBSD #include @@ -487,7 +488,8 @@ bool zmq::ws_engine_t::server_handshake () // Sec-WebSocket-Protocol can appear multiple times or be a comma separated list // if _websocket_protocol is already set we skip the check if (_websocket_protocol[0] == '\0') { - char *p = strtok (_header_value, ","); + char *rest; + char *p = strtok_r (_header_value, ",", &rest); while (p != NULL) { if (*p == ' ') p++; @@ -497,7 +499,7 @@ bool zmq::ws_engine_t::server_handshake () break; } - p = strtok (NULL, ","); + p = strtok_r (NULL, ",", &rest); } } } From 851ae90319892301401adb458263459dd5c1457b Mon Sep 17 00:00:00 2001 From: Denis Collette Date: Wed, 22 Jan 2020 19:59:51 -0400 Subject: [PATCH 2/3] Problem: No relicense agreement by Denis Collette Solution: added relicence agreement --- RELICENSE/colletted.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 RELICENSE/colletted.md diff --git a/RELICENSE/colletted.md b/RELICENSE/colletted.md new file mode 100644 index 00000000..37a67966 --- /dev/null +++ b/RELICENSE/colletted.md @@ -0,0 +1,7 @@ +Permission to Relicense under MPLv2 or any other OSI approved license chosen by the current ZeroMQ BDFL + +This is a statement by Denis Collette that grants permission to relicense its copyrights in the libzmq C++ library (ZeroMQ) under the Mozilla Public License v2 (MPLv2) or any other Open Source Initiative approved license chosen by the current ZeroMQ BDFL (Benevolent Dictator for Life). + +A portion of the commits made by the Github handle "colletted", with commit author "Denis Collette denisncollette@gmail.com", are copyright of Denis Collette. This document hereby grants the libzmq project team to relicense libzmq, including all past, present and future contributions of the author listed above. + +Denis Collette 2020/01/22 From 64fc10612317aee63fd85aea77c645a9c69c88fb Mon Sep 17 00:00:00 2001 From: Denis Collette Date: Wed, 22 Jan 2020 20:15:50 -0400 Subject: [PATCH 3/3] Problem: preious commit contains tabs Solution: replace tabs with spaces --- src/ws_engine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ws_engine.cpp b/src/ws_engine.cpp index 25c5a20d..38120bf3 100644 --- a/src/ws_engine.cpp +++ b/src/ws_engine.cpp @@ -489,7 +489,7 @@ bool zmq::ws_engine_t::server_handshake () // if _websocket_protocol is already set we skip the check if (_websocket_protocol[0] == '\0') { char *rest; - char *p = strtok_r (_header_value, ",", &rest); + char *p = strtok_r (_header_value, ",", &rest); while (p != NULL) { if (*p == ' ') p++;