Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ieee1905
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Multi-AP
ieee1905
Commits
a04f47ef
Commit
a04f47ef
authored
Jun 14, 2021
by
Jakob Olsson
Browse files
Options
Downloads
Patches
Plain Diff
wsc: memory fixes for vendor extension handling
parent
4794988a
Branches
fm-dev-steer
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/i1905_wsc.c
+17
-19
17 additions, 19 deletions
src/i1905_wsc.c
with
17 additions
and
19 deletions
src/i1905_wsc.c
+
17
−
19
View file @
a04f47ef
...
...
@@ -1110,33 +1110,31 @@ int wsc_process_m2(uint8_t *m1, uint16_t m1_size, void *key,
uint8_t
*
end_of_ext
;
uint8_t
subelem
;
uint8_t
len
;
uint8_t
*
tmp_p
;
tmp_p
=
p
;
/* May be one or more subelements (Section 12 of WSC spec) */
end_of_ext
=
p
+
attr_len
;
memcpy
(
id
,
p
,
sizeof
(
id
));
p
+=
3
;
attr_len
-=
3
;
memcpy
(
id
,
tmp_p
,
sizeof
(
id
));
tmp_p
+=
3
;
if
(
id
[
0
]
==
WFA_VENDOR_ID_1
&&
id
[
1
]
==
WFA_VENDOR_ID_2
&&
id
[
2
]
==
WFA_VENDOR_ID_3
)
{
while
(
p
<
end_of_ext
)
{
memcpy
(
&
subelem
,
p
,
1
);
p
+=
1
;
attr_len
-=
1
;
while
(
tmp_p
<
end_of_ext
)
{
memcpy
(
&
subelem
,
tmp_p
,
1
);
tmp_p
+=
1
;
memcpy
(
&
len
,
p
,
1
);
p
+=
1
;
attr_len
-=
1
;
memcpy
(
&
len
,
tmp_p
,
1
);
tmp_p
+=
1
;
if
(
subelem
==
WFA_ELEM_MAP
)
{
// Map extension subelement will be 1 byte
memcpy
(
&
mapie
,
p
,
1
);
p
+=
1
;
attr_len
-=
1
;
/* Map extension subelement will be 1 byte */
memcpy
(
&
mapie
,
tmp_p
,
1
);
tmp_p
+=
1
;
}
else
{
p
+=
len
;
attr_len
-=
len
;
tmp_p
+=
len
;
}
}
...
...
@@ -1159,7 +1157,7 @@ int wsc_process_m2(uint8_t *m1, uint16_t m1_size, void *key,
}
else
{
uint8_t
*
tmp
;
tmp
=
realloc
(
*
ext
,
attr_len
+
4
);
tmp
=
realloc
(
*
ext
,
*
extlen
+
attr_len
+
4
);
if
(
!
tmp
)
break
;
...
...
@@ -1168,8 +1166,8 @@ int wsc_process_m2(uint8_t *m1, uint16_t m1_size, void *key,
ext_ptr
=
*
ext
+
start
;
bufptr_put_be16
(
ext_ptr
,
attr_type
);
bufptr_put_be16
(
ext_ptr
,
attr_len
);
memcpy
(
ext_ptr
,
(
p
-
3
),
attr_len
)
;
memcpy
(
ext_ptr
,
p
,
attr_len
);
tmp_p
+=
attr_len
;
*
extlen
+=
attr_len
+
4
;
}
}
...
...
This diff is collapsed.
Click to expand it.
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
sign in
to comment