Gitiles
Code Review
Sign In
gerrit-public.fairphone.software
/
fp2-dev
/
platform
/
external
/
compiler-rt
/
c655cfa8dc0fdf5b521e565f6cbdbf7981fba1b2
/
.
/
lib
/
asan
/
tests
/
strncpy-overflow.cc
blob: 044f6494bfa1778968b50508a43f2d9e7cc29ffd [
file
] [
log
] [
blame
]
#include
<string.h>
#include
<stdlib.h>
int
main
(
int
argc
,
char
**
argv
)
{
char
*
hello
=
(
char
*)
malloc
(
6
);
strcpy
(
hello
,
"hello"
);
char
*
short_buffer
=
(
char
*)
malloc
(
9
);
strncpy
(
short_buffer
,
hello
,
10
);
// BOOM
return
short_buffer
[
8
];
}