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

Addressing crash report involving strlen #97

Merged
merged 2 commits into from
Apr 15, 2021
Merged

Addressing crash report involving strlen #97

merged 2 commits into from
Apr 15, 2021

Conversation

abbeycode
Copy link
Owner

I got a crash report in UnrarKit in this code:

    const char *filenameData = (const char *) [rarFile UTF8String];
    self.flags->ArcName = new char[strlen(filenameData) + 1]; // <---- Crash here
    strcpy(self.flags->ArcName, filenameData);

I was unable to reproduce, but it seems like since ArcName has a life beyond -_unrarOpenFile:inMode:withPassword:error:, it should be allocated on the heap instead of the stack.

@abbeycode abbeycode added the bug label Apr 15, 2021
@abbeycode abbeycode added this to the 2.10 milestone Apr 15, 2021
@abbeycode abbeycode merged commit 589e6af into v2.10 Apr 15, 2021
@abbeycode abbeycode deleted the strlen-crash branch February 10, 2022 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant