mirror of
https://cagebreak.project-repo.co/cagebreak.git
synced 2026-08-23 14:04:19 +02:00
Fix fuzzing
- Fix fuzzing build - Fix bugs found by fuzzer
This commit is contained in:
parent
9d1cafa2f6
commit
02b73fb2b2
6 changed files with 138 additions and 74 deletions
|
|
@ -38,7 +38,7 @@ set_configuration(struct cg_server *server, char *content) {
|
|||
(line = strtok_r(NULL, "\n", &content)) != NULL; ++line_num) {
|
||||
line[strcspn(line, "\n")] = '\0';
|
||||
if(*line != '\0' && *line != '#') {
|
||||
char *errstr;
|
||||
char *errstr=NULL;
|
||||
server->running = true;
|
||||
if(parse_rc_line(server, line, &errstr) != 0) {
|
||||
if(errstr != NULL) {
|
||||
|
|
@ -56,10 +56,9 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||
if(size == 0) {
|
||||
return 0;
|
||||
}
|
||||
int max_line_size = 256 > size ? size : 256;
|
||||
char *str = malloc(sizeof(char) * max_line_size);
|
||||
strncpy(str, (char *)data, max_line_size);
|
||||
str[max_line_size - 1] = 0;
|
||||
char *str = malloc(sizeof(char) * size);
|
||||
strncpy(str, (char *)data, size);
|
||||
str[size - 1] = 0;
|
||||
set_configuration(&server, str);
|
||||
free(str);
|
||||
keybinding_list_free(server.keybindings);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue