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

ccn-lite-fetch memory corrupion #386

Open
MahdiBaghbani opened this issue Mar 30, 2021 · 0 comments
Open

ccn-lite-fetch memory corrupion #386

MahdiBaghbani opened this issue Mar 30, 2021 · 0 comments

Comments

@MahdiBaghbani
Copy link
Contributor

freeing a pointer causes memory corruption in ccn-lite-fetch

here in code:

*prefix = ccnl_prefix_dup(pkt->pfx);
*lastchunknum = pkt->val.final_block_id;
*content = pkt->content;
*contentlen = pkt->contlen;
ccnl_pkt_free(pkt);

assigning content and content length pointer values from pkt to external pointers and then freeing the pkt itself also removes the pointers pointing to the memory location and causes memory corruption and garbage output from any write operation:

write(1, content, contlen);

possible solution would be passing the pkt itself out of function and free it after write function

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