use static initialization for output string in RenderCurrentFolder #473
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/render-current-folder"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The dynamic sized variable
outputString
may not be properly initialized.Second issue, we fill the line for directories beyond
fileNameLength
, so the initialization is not always sufficient.00a74c15eb/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp (L912-L916)
In this case,
fileNameWasCut == false
, sofileNameLen < MAX_PRINTABLE_FILENAME_LEN
and we declaredoutputString[fileNameLen]
.So if
fileNameLen > MAX_PRINTABLE_FILENAME_LEN - 7
we write beyond the array bounds.Resolution
We now initialize
outputString
statically with the maximum printable size which should resolve both.Also clean up some variable declarations.
Requirements
The described bug only affects targets with
KNUTWURST_DGUS2_TFT
.The static initialization affects all targets.
Benefits
Resolves potential memory issues during file list rendering.
Configurations
none
Related Issues
none
Thanks!