Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
1a8e22e8
Commit
1a8e22e8
authored
Jul 22, 2018
by
Nelson Elhage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a config file fuzzer
parent
64138b70
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
fuzzers/config_file_fuzzer.c
+41
-0
No files found.
fuzzers/config_file_fuzzer.c
0 → 100644
View file @
1a8e22e8
#include <git2.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <limits.h>
int
foreach_cb
(
const
git_config_entry
*
entry
,
void
*
payload
)
{
return
0
;
}
int
LLVMFuzzerTestOneInput
(
const
uint8_t
*
data
,
size_t
size
)
{
static
int
fd
=
-
1
;
static
char
path
[]
=
"/tmp/git.XXXXXX"
;
if
(
fd
<
0
)
{
git_libgit2_init
();
fd
=
mkstemp
(
path
);
if
(
fd
<
0
)
{
abort
();
}
}
if
(
ftruncate
(
fd
,
0
)
!=
0
)
{
abort
();
}
if
(
lseek
(
fd
,
0
,
SEEK_SET
)
!=
0
)
{
abort
();
}
if
(
write
(
fd
,
data
,
size
)
!=
size
)
{
abort
();
}
git_config
*
cfg
;
int
err
=
git_config_open_ondisk
(
&
cfg
,
path
);
if
(
err
==
0
)
{
git_config_foreach
(
cfg
,
foreach_cb
,
NULL
);
git_config_free
(
cfg
);
}
return
0
;
}
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