Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AndroidSystemCore
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository 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
Werner Sembach
AndroidSystemCore
Commits
cb1a2b98
Commit
cb1a2b98
authored
Jan 3, 2018
by
android-build-team Robot
Browse files
Options
Downloads
Plain Diff
Snap for 4485699 from
9f30f3bb
to oc-m2-release
Change-Id: Ia84c5d6f459736d07f4ec01dbb5c0b721b5f10e0
parents
86c2b588
9f30f3bb
Branches
oreo-m2-release
Branches containing commit
Tags
android-8.1.0_r20
android-8.1.0_r8
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
libnetutils/packet.c
+14
-0
14 additions, 0 deletions
libnetutils/packet.c
with
14 additions
and
0 deletions
libnetutils/packet.c
+
14
−
0
View file @
cb1a2b98
...
...
@@ -218,6 +218,20 @@ int receive_packet(int s, struct dhcp_msg *msg)
* to construct the pseudo header used in the checksum calculation.
*/
dhcp_size
=
ntohs
(
packet
.
udp
.
len
)
-
sizeof
(
packet
.
udp
);
/*
* check validity of dhcp_size.
* 1) cannot be negative or zero.
* 2) src buffer contains enough bytes to copy
* 3) cannot exceed destination buffer
*/
if
((
dhcp_size
<=
0
)
||
((
int
)(
nread
-
sizeof
(
struct
iphdr
)
-
sizeof
(
struct
udphdr
))
<
dhcp_size
)
||
((
int
)
sizeof
(
struct
dhcp_msg
)
<
dhcp_size
))
{
#if VERBOSE
ALOGD
(
"Malformed Packet"
);
#endif
return
-
1
;
}
saddr
=
packet
.
ip
.
saddr
;
daddr
=
packet
.
ip
.
daddr
;
nread
=
ntohs
(
packet
.
ip
.
tot_len
);
...
...
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
register
or
sign in
to comment