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

Mitigate NULL dereference in memcpy #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dTenebrae
Copy link

Call stack ..-> gip_dispatch_pkt() -> gip_handle_pkt_announce() -> gip_request_identification()->gip_send_pkt(client, &hdr, NULL) leads to NULL dereference in memcpy function. Quite sure, it can't really happen in real life, but compiler spams an error:

bus/protocol.c:382:9: error: argument 2 null where non-null expected [-Werror=nonnull]
  382 |         memcpy(client->chunk_buf_in->data, data, hdr->chunk_offset);

This NULL check will calm down a compiler.

Call stack  ..-> gip_dispatch_pkt() -> gip_handle_pkt_announce()
-> gip_request_identification()->gip_send_pkt(client, &hdr, NULL)
leads to NULL dereference in memcpy function. Quite sure, it
can't really happen in real life, but compiler spams an error:

```
bus/protocol.c:382:9: error: argument 2 null where non-null expected [-Werror=nonnull]
  382 |         memcpy(client->chunk_buf_in->data, data, hdr->chunk_offset);
```

This NULL check will calm down a compiler.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant