Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dhtnet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
dhtnet
Commits
4cf587e6
Commit
4cf587e6
authored
1 year ago
by
Sébastien Blin
Browse files
Options
Downloads
Patches
Plain Diff
natpmp: avoid crash due to FD_SET
GitLab:
#23
Change-Id: Ife39db96ee554adf547606c5e3a14fc53c13cda9
parent
45b50697
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/upnp/protocol/natpmp/nat_pmp.cpp
+6
-4
6 additions, 4 deletions
src/upnp/protocol/natpmp/nat_pmp.cpp
with
6 additions
and
4 deletions
src/upnp/protocol/natpmp/nat_pmp.cpp
+
6
−
4
View file @
4cf587e6
...
...
@@ -15,6 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include
"nat_pmp.h"
#include
<poll.h>
#if HAVE_LIBNATPMP
...
...
@@ -333,13 +334,14 @@ NatPmp::readResponse(natpmp_t& handle, natpmpresp_t& response)
break
;
}
fd_set
fds
;
struct
pollfd
fds
;
fds
.
fd
=
handle
.
s
;
fds
.
events
=
POLLIN
;
struct
timeval
timeout
;
FD_ZERO
(
&
fds
);
FD_SET
(
handle
.
s
,
&
fds
);
getnatpmprequesttimeout
(
&
handle
,
&
timeout
);
uint64_t
millis
=
(
timeout
.
tv_sec
*
(
uint64_t
)
1000
)
+
(
timeout
.
tv_usec
/
1000
);
// Wait for data.
if
(
select
(
FD_SETSIZE
,
&
fds
,
NULL
,
NULL
,
&
timeout
)
==
-
1
)
{
if
(
poll
(
&
fds
,
1
,
millis
)
==
-
1
)
{
err
=
NATPMP_ERR_SOCKETERROR
;
break
;
}
...
...
This diff is collapsed.
Click to expand it.
François-Simon Fauteux-Chapleau
@ffauteux-chapleau
mentioned in issue
jami-daemon#1040
·
1 month ago
mentioned in issue
jami-daemon#1040
mentioned in issue jami-daemon#1040
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment