Skip to content

ccn-lite-fetch memory corrupion #386

@MahdiBaghbani

Description

@MahdiBaghbani

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions