Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
1dbe38d6
Commit
1dbe38d6
authored
Sep 24, 2020
by
Fabrice Bellet
Committed by
Olivier Crête
Dec 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test-fallback: fix stack buffer overflow with new candidate API
parent
c4c3fed0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
tests/test-fallback.c
tests/test-fallback.c
+31
-31
No files found.
tests/test-fallback.c
View file @
1dbe38d6
...
@@ -215,16 +215,15 @@ static void priv_get_local_addr (NiceAgent *agent, guint stream_id, guint compon
...
@@ -215,16 +215,15 @@ static void priv_get_local_addr (NiceAgent *agent, guint stream_id, guint compon
static
int
run_fallback_test
(
NiceAgent
*
lagent
,
NiceAgent
*
ragent
,
NiceAddress
*
baseaddr
)
static
int
run_fallback_test
(
NiceAgent
*
lagent
,
NiceAgent
*
ragent
,
NiceAddress
*
baseaddr
)
{
{
NiceAddress
laddr
,
raddr
,
laddr_rtcp
,
raddr_rtcp
;
NiceAddress
laddr
,
raddr
,
laddr_rtcp
,
raddr_rtcp
;
NiceCandidate
cdes
;
NiceCandidate
*
cdes
;
GSList
*
cands
;
GSList
*
cands
;
guint
ls_id
,
rs_id
;
guint
ls_id
,
rs_id
;
memset
(
&
cdes
,
0
,
sizeof
(
NiceCandidate
));
cdes
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_HOST
);
cdes
.
priority
=
100000
;
cdes
->
priority
=
100000
;
strcpy
(
cdes
.
foundation
,
"1"
);
strcpy
(
cdes
->
foundation
,
"1"
);
cdes
.
type
=
NICE_CANDIDATE_TYPE_HOST
;
cdes
->
transport
=
NICE_CANDIDATE_TRANSPORT_UDP
;
cdes
.
transport
=
NICE_CANDIDATE_TRANSPORT_UDP
;
cdes
->
base_addr
=
*
baseaddr
;
cdes
.
base_addr
=
*
baseaddr
;
/* step: initialize variables modified by the callbacks */
/* step: initialize variables modified by the callbacks */
global_components_ready
=
0
;
global_components_ready
=
0
;
...
@@ -291,16 +290,16 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress
...
@@ -291,16 +290,16 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress
/* step: exchange candidate information but not the credentials */
/* step: exchange candidate information but not the credentials */
cands
=
g_slist_append
(
NULL
,
&
cdes
);
cands
=
g_slist_append
(
NULL
,
cdes
);
cdes
.
component_id
=
NICE_COMPONENT_TYPE_RTP
;
cdes
->
component_id
=
NICE_COMPONENT_TYPE_RTP
;
cdes
.
addr
=
raddr
;
cdes
->
addr
=
raddr
;
nice_agent_set_remote_candidates
(
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTP
,
cands
);
nice_agent_set_remote_candidates
(
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTP
,
cands
);
cdes
.
addr
=
laddr
;
cdes
->
addr
=
laddr
;
nice_agent_set_remote_candidates
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
,
cands
);
nice_agent_set_remote_candidates
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
,
cands
);
cdes
.
component_id
=
NICE_COMPONENT_TYPE_RTCP
;
cdes
->
component_id
=
NICE_COMPONENT_TYPE_RTCP
;
cdes
.
addr
=
raddr_rtcp
;
cdes
->
addr
=
raddr_rtcp
;
nice_agent_set_remote_candidates
(
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTCP
,
cands
);
nice_agent_set_remote_candidates
(
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTCP
,
cands
);
cdes
.
addr
=
laddr_rtcp
;
cdes
->
addr
=
laddr_rtcp
;
nice_agent_set_remote_candidates
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTCP
,
cands
);
nice_agent_set_remote_candidates
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTCP
,
cands
);
/* step: fall back to non-ICE mode on both sides */
/* step: fall back to non-ICE mode on both sides */
...
@@ -339,6 +338,7 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress
...
@@ -339,6 +338,7 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress
/* step: clean up resources and exit */
/* step: clean up resources and exit */
g_slist_free
(
cands
);
g_slist_free
(
cands
);
nice_candidate_free
(
cdes
);
nice_agent_remove_stream
(
lagent
,
ls_id
);
nice_agent_remove_stream
(
lagent
,
ls_id
);
nice_agent_remove_stream
(
ragent
,
rs_id
);
nice_agent_remove_stream
(
ragent
,
rs_id
);
...
@@ -351,15 +351,14 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress
...
@@ -351,15 +351,14 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress
static
int
run_safe_fallback_test
(
NiceAgent
*
lagent
,
NiceAgent
*
ragent
,
NiceAddress
*
baseaddr
)
static
int
run_safe_fallback_test
(
NiceAgent
*
lagent
,
NiceAgent
*
ragent
,
NiceAddress
*
baseaddr
)
{
{
NiceAddress
laddr
,
raddr
,
laddr_rtcp
,
raddr_rtcp
;
NiceAddress
laddr
,
raddr
,
laddr_rtcp
,
raddr_rtcp
;
NiceCandidate
cdes
;
NiceCandidate
*
cdes
;
guint
ls_id
,
rs_id
;
guint
ls_id
,
rs_id
;
memset
(
&
cdes
,
0
,
sizeof
(
NiceCandidate
));
cdes
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_HOST
);
cdes
.
priority
=
100000
;
cdes
->
priority
=
100000
;
strcpy
(
cdes
.
foundation
,
"1"
);
strcpy
(
cdes
->
foundation
,
"1"
);
cdes
.
type
=
NICE_CANDIDATE_TYPE_HOST
;
cdes
->
transport
=
NICE_CANDIDATE_TRANSPORT_UDP
;
cdes
.
transport
=
NICE_CANDIDATE_TRANSPORT_UDP
;
cdes
->
base_addr
=
*
baseaddr
;
cdes
.
base_addr
=
*
baseaddr
;
/* step: initialize variables modified by the callbacks */
/* step: initialize variables modified by the callbacks */
global_components_ready
=
0
;
global_components_ready
=
0
;
...
@@ -427,19 +426,19 @@ static int run_safe_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAdd
...
@@ -427,19 +426,19 @@ static int run_safe_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAdd
/* step: exchange candidate information but not the credentials */
/* step: exchange candidate information but not the credentials */
cdes
.
component_id
=
NICE_COMPONENT_TYPE_RTP
;
cdes
->
component_id
=
NICE_COMPONENT_TYPE_RTP
;
cdes
.
addr
=
raddr
;
cdes
->
addr
=
raddr
;
g_assert
(
nice_agent_set_selected_remote_candidate
(
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTP
,
&
cdes
));
g_assert
(
nice_agent_set_selected_remote_candidate
(
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTP
,
cdes
));
cdes
.
addr
=
laddr
;
cdes
->
addr
=
laddr
;
g_assert
(
nice_agent_set_selected_remote_candidate
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
,
&
cdes
));
g_assert
(
nice_agent_set_selected_remote_candidate
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
,
cdes
));
cdes
.
component_id
=
NICE_COMPONENT_TYPE_RTCP
;
cdes
->
component_id
=
NICE_COMPONENT_TYPE_RTCP
;
cdes
.
addr
=
raddr_rtcp
;
cdes
->
addr
=
raddr_rtcp
;
g_assert
(
nice_agent_set_selected_remote_candidate
(
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTCP
,
&
cdes
));
g_assert
(
nice_agent_set_selected_remote_candidate
(
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTCP
,
cdes
));
cdes
.
addr
=
laddr_rtcp
;
cdes
->
addr
=
laddr_rtcp
;
g_assert
(
nice_agent_set_selected_remote_candidate
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTCP
,
&
cdes
));
g_assert
(
nice_agent_set_selected_remote_candidate
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTCP
,
cdes
));
g_debug
(
"test-fallback: Requested for fallback, running mainloop until component state change is completed..."
);
g_debug
(
"test-fallback: Requested for fallback, running mainloop until component state change is completed..."
);
...
@@ -470,6 +469,7 @@ static int run_safe_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAdd
...
@@ -470,6 +469,7 @@ static int run_safe_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAdd
/* step: clean up resources and exit */
/* step: clean up resources and exit */
nice_candidate_free
(
cdes
);
nice_agent_remove_stream
(
lagent
,
ls_id
);
nice_agent_remove_stream
(
lagent
,
ls_id
);
nice_agent_remove_stream
(
ragent
,
rs_id
);
nice_agent_remove_stream
(
ragent
,
rs_id
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment