Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs report #6

Open
panhao410 opened this issue Dec 25, 2023 · 0 comments
Open

Bugs report #6

panhao410 opened this issue Dec 25, 2023 · 0 comments

Comments

@panhao410
Copy link

There are two bugs,one is in the args.c:111

     case 'p': // parse pending time
	    {
		time_t *t;

		if(parse_long(optarg, (void **)&t) != 4)
		    usage("error: invalid pending time.", 1);

		pool->pending_time = *t;
		free(t);
		break;
	    }

When you add ASAN during compilation, runtime errors will occur, mainly because free is used to free the memory space allocated for calling calloc, malloc, or realloc, rather than time_ t type(I’m not sure)

ASAN
ASAN_1

gdb debug information
gdb_1

Another bug is in the options.c:387

void
append_option (dhcp_option_list *list, dhcp_option *opt)
{
    dhcp_option *nopt = calloc(1, sizeof(*nopt));
    memcpy(nopt, opt, 2 + opt->len);
    
    TAILQ_INSERT_TAIL(list, nopt, pointers);
}

When opt ->len is not properly initialized or has incorrect values, it can cause stack overflow issues in memcpy

ASAN
ASAN_2

gdb debug information
gdb_2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant