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

possibly realloc 0 size and cause uaf #1578

Open
yebeloved opened this issue May 22, 2016 · 1 comment
Open

possibly realloc 0 size and cause uaf #1578

yebeloved opened this issue May 22, 2016 · 1 comment

Comments

@yebeloved
Copy link

yebeloved commented May 22, 2016

I think it may cause a potential bug in list.c if bs_list_trim is called and list->n is 0. Because in such condition, when resize being called,
p = realloc(list->ids, sizeof(int) * new_size); acts like free function but list->data still points to the freed memory. It may cause use-after-free.
Although bs_list_trim hasn't been called now, I think it is a potential issue and we could add some check to make the code safer. Thanks.

@iphydf
Copy link
Contributor

iphydf commented Aug 20, 2016

If list->n == 0, then list->data will never be accessed.

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

2 participants