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

Fix longFilename NULL pointer dereference #20115

Conversation

sjasonsmith
Copy link
Contributor

Description

SdBaseFile::readDir is sometimes called with a null longFilename pointer. This is certainly true when working with a RepRapDiscountFullGraphics display.

This checks the pointer value prior to attempting to use it.

Benefits

Avoid crash on boot.

Configurations

I tested this in the simulator using the files in the following zip file. The SD image has to be placed in the folder next to the executable.
Marlin.zip

There is also a config in the linked issue.

Related Issues

#20114 - UTF_FILENAME_SUPPORT

@sjasonsmith
Copy link
Contributor Author

@LinFor I only tested this with my "normal" case, I didn't do anything to verify that the UTF-8 conversion still works properly.

Please take a look and let me know what you think.

Marlin/src/sd/SdBaseFile.cpp Outdated Show resolved Hide resolved
@thinkyhead thinkyhead merged commit 288eb06 into MarlinFirmware:bugfix-2.0.x Nov 13, 2020
FhlostonParadise pushed a commit to FhlostonParadise/Marlin that referenced this pull request Nov 21, 2020
@sjasonsmith sjasonsmith deleted the PR/Bug20087_UTF8_Null_Dereference branch November 23, 2020 09:28
Kannix2005 pushed a commit to Kannix2005/Marlin-1 that referenced this pull request Dec 7, 2020
vgadreau pushed a commit to vgadreau/Marlin that referenced this pull request Dec 9, 2020
tharts pushed a commit to tharts/Marlin that referenced this pull request Jan 6, 2021
dpreed pushed a commit to dpreed/Marlin_2.0.x that referenced this pull request Feb 5, 2021
kpishere pushed a commit to kpishere/Marlin that referenced this pull request Feb 19, 2021
W4tel-BiDi pushed a commit to W4tel-BiDi/Marlin that referenced this pull request Apr 5, 2021
thinkyhead pushed a commit that referenced this pull request Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants