diff --git a/ChangeLog.txt b/ChangeLog.txt index 61b885a0..a681f57e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,7 @@ Broker: - Fix incorrect bridge connection notifications on local broker. - Fix persistent db writing on Windows. Closes #464779. - ACLs are now checked before sending a will message. +- Fix possible crash when using bridges on Windows. Closes #465384. Client library: - Inflight message count wasn't being decreased for outgoing messages using diff --git a/src/loop.c b/src/loop.c index 42f6fd5b..c548fb5e 100644 --- a/src/loop.c +++ b/src/loop.c @@ -453,11 +453,7 @@ static void loop_handle_errors(struct mosquitto_db *db, struct pollfd *pollfds) static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pollfds) { struct mosquitto *context, *ctxt_tmp; -#ifdef WIN32 - char err; -#else int err; -#endif socklen_t len; HASH_ITER(hh_sock, db->contexts_by_sock, context, ctxt_tmp){ @@ -475,7 +471,7 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol #endif if(context->state == mosq_cs_connect_pending){ len = sizeof(int); - if(!getsockopt(context->sock, SOL_SOCKET, SO_ERROR, &err, &len)){ + if(!getsockopt(context->sock, SOL_SOCKET, SO_ERROR, (char *)&err, &len)){ if(err == 0){ context->state = mosq_cs_new; }