Skip to content

Commit 0e1da90

Browse files
committed
Fix feedback from review
1 parent 6fe5e0e commit 0e1da90

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

.github/workflows/sec-websocket-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
cd build
5353
# Note: -Wno-error=sign-conversion works around a sign mismatch in
5454
# libwebsockets v4.3.3 openssl-server.c:311 (lws_filepos_t -> long)
55-
cmake .. -DLWS_WITH_WOLFSSL=1 -DLWS_WOLFSSL_INCLUDE_DIRS=/usr/local/include/wolfssl -DLWS_WOLFSSL_LIBRARIES=/usr/local/lib/libwolfssl.so -DLWS_WITH_EXTERNAL_POLL=1 -DLWS_WITHOUT_TESTAPPS=ON -DCMAKE_C_FLAGS="-Wno-error=sign-conversion" ..
55+
cmake .. -DLWS_WITH_WOLFSSL=1 -DLWS_WOLFSSL_INCLUDE_DIRS=/usr/local/include/wolfssl -DLWS_WOLFSSL_LIBRARIES=/usr/local/lib/libwolfssl.so -DLWS_WITH_EXTERNAL_POLL=1 -DLWS_WITHOUT_TESTAPPS=ON -DCMAKE_C_FLAGS="-Wno-error=sign-conversion"
5656
make
5757
sudo make install
5858

src/mqtt_broker.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,10 @@ static int BrokerStrCompare(const char* a, const char* b)
159159
for (i = 0; i < max_len; i++) {
160160
/* Branchless index clamp: when i >= len, reads position 0.
161161
* Length mismatch is caught by the final XOR below. */
162-
int ia = i & -(i < len_a);
163-
int ib = i & -(i < len_b);
162+
unsigned int maskA = 0u - (unsigned int)(i < len_a);
163+
unsigned int maskB = 0u - (unsigned int)(i < len_b);
164+
int ia = (int)((unsigned int)i & maskA);
165+
int ib = (int)((unsigned int)i & maskB);
164166
result |= (a[ia] ^ b[ib]);
165167
}
166168
result |= (len_a ^ len_b);
@@ -3080,10 +3082,9 @@ static int BrokerHandle_Subscribe(BrokerClient* bc, int rx_len,
30803082
if (sub_rc != MQTT_CODE_SUCCESS) {
30813083
granted_qos = (MqttQoS)MQTT_SUBSCRIBE_ACK_CODE_FAILURE;
30823084
}
3083-
30843085
#ifdef WOLFMQTT_BROKER_RETAINED
3085-
/* Deliver retained messages matching this filter */
3086-
{
3086+
else {
3087+
/* Deliver retained messages matching this filter */
30873088
char filter_z[BROKER_MAX_FILTER_LEN];
30883089
word16 copy_len = flen;
30893090
if (copy_len >= BROKER_MAX_FILTER_LEN) {

0 commit comments

Comments
 (0)