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

Potential realloc function #250

Open
MicroMilo opened this issue Sep 20, 2024 · 0 comments
Open

Potential realloc function #250

MicroMilo opened this issue Sep 20, 2024 · 0 comments

Comments

@MicroMilo
Copy link

MicroMilo commented Sep 20, 2024

I noticed a lot of realloc functions being used in projects, but I think there is one that may have a potential CWE401 memory leak.

location: src\jansson\src\strbuffer.c#strbuffer_append_bytes:74

strbuff->value = realloc(strbuff->value, strbuff->size);

Once strbuff->size is too big, the operation will fail, and then the original strbuff->value will leak. Then I watch on the call chain about the function strbuffer_append_bytes.

  • ws_process_read_data, websocket.c
  • ws_execute, websocket.c
  • json_reply, formats/json.c
  • json_string_output, formats/json.c
  • json_dumps, jansson/src/dump.c
  • dump_to_strbuffer, jansson/src/dump.c

due to the function ws_process_read_data, I think it is possible to cause realloc function failed.

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