Skip to content
Snippets Groups Projects
Commit 0a88718c authored by Olivier Dion's avatar Olivier Dion Committed by Andreas Traczyk
Browse files

contrib/pjproject: Fix offset by 1 error

Variables `stun_sock->*_nb` are initialized to -1 and incremented by 1 for each
new socket.  Thus, the `<=` comparison operator should be used for iteration
instead of `<`.

Gitlab: #613
Change-Id: I3c6971f533ead466b25381f3d4edbc4dc1827950
parent bd54b333
No related branches found
No related tags found
No related merge requests found
......@@ -3678,7 +3678,7 @@ index 5fe825cf5..6dbd296f2 100644
stun_sock->sock_fd = PJ_INVALID_SOCKET;
}
+ for (int i = 0; i < stun_sock->incoming_nb ; ++i) {
+ for (int i = 0; i <= stun_sock->incoming_nb ; ++i) {
+ if (stun_sock->incoming_socks[i].sock != NULL) {
+ stun_sock->incoming_socks[i].fd = PJ_INVALID_SOCKET;
+ pj_activesock_close(stun_sock->incoming_socks[i].sock);
......@@ -3688,7 +3688,7 @@ index 5fe825cf5..6dbd296f2 100644
+ }
+ }
+
+ for (int i = 0; i < stun_sock->outgoing_nb ; ++i) {
+ for (int i = 0; i <= stun_sock->outgoing_nb ; ++i) {
+ if (stun_sock->outgoing_socks[i].sock != NULL) {
+ stun_sock->outgoing_socks[i].fd = PJ_INVALID_SOCKET;
+ pj_activesock_close(stun_sock->outgoing_socks[i].sock);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment