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
7ac60686
Commit
7ac60686
authored
May 27, 2015
by
Adam Lesinski
Committed by
Android Git Automerger
May 27, 2015
Browse files
Options
Downloads
Plain Diff
am
058ad0b6
: am
e8582d65
: am
9bd7afc0
: Prevent integer overflow when allocating native_handle_t
* commit '
058ad0b6
': Prevent integer overflow when allocating native_handle_t
parents
66723007
058ad0b6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
libcutils/native_handle.c
+13
-5
13 additions, 5 deletions
libcutils/native_handle.c
with
13 additions
and
5 deletions
libcutils/native_handle.c
+
13
−
5
View file @
7ac60686
...
...
@@ -25,14 +25,22 @@
#include
<cutils/log.h>
#include
<cutils/native_handle.h>
static
const
int
kMaxNativeFds
=
1024
;
static
const
int
kMaxNativeInts
=
1024
;
native_handle_t
*
native_handle_create
(
int
numFds
,
int
numInts
)
{
native_handle_t
*
h
=
malloc
(
sizeof
(
native_handle_t
)
+
sizeof
(
int
)
*
(
numFds
+
numInts
));
if
(
numFds
<
0
||
numInts
<
0
||
numFds
>
kMaxNativeFds
||
numInts
>
kMaxNativeInts
)
{
return
NULL
;
}
size_t
mallocSize
=
sizeof
(
native_handle_t
)
+
(
sizeof
(
int
)
*
(
numFds
+
numInts
));
native_handle_t
*
h
=
malloc
(
mallocSize
);
if
(
h
)
{
h
->
version
=
sizeof
(
native_handle_t
);
h
->
numFds
=
numFds
;
h
->
numInts
=
numInts
;
}
return
h
;
}
...
...
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