fix(main): Add warning for log paths that are too long#1481
Conversation
Added a warning message when the path provided to --log-file exceeds the buffer size, informing the user that the path will be truncated to prevent memory corruption.
|
Thanks for the submission, @Ferdinaelectro1 Could I suggest a change? This would be a terminal failure - if a user is explicitly providing a path, with the expectation that the file is written there, the safer route may be to just terminate execution with the error, rather than try to proceed. |
|
@tdewey-rpi Thank you for the suggestion, that makes sense. I agree that if the user explicitly provides a log path, silently truncating it could lead to unexpected behavior. |
| static char logPathBuffer[512]; | ||
| if(strlen(logPath) + strlen("-elevated") >= sizeof(logPathBuffer)) { | ||
| fprintf(stderr, "[ERROR] log path '%s' is too long and cannot be used safely\n", logPath); | ||
| return EXIT_FAILURE; |
|
Thanks for responding to the feedback, @Ferdinaelectro1 My pleasure to merge this. |
|
Tkanks
Le mar. 27 janv. 2026 à 11:11, Tom Dewey ***@***.***> a
écrit :
… *tdewey-rpi* left a comment (raspberrypi/rpi-imager#1481)
<#1481 (comment)>
Thanks for responding to the feedback, @Ferdinaelectro1
<https://github.com/Ferdinaelectro1>
My pleasure to merge this.
—
Reply to this email directly, view it on GitHub
<#1481 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BJN5NWLPDO4WFOROXXRGLRD4I42U5AVCNFSM6AAAAACS2DYFP6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQMBUGI4DCOJRHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Thank you so much for merging my PR! I’m really happy to contribute.
I would love to continue helping the project. Is there any task, issue, or
feature that I could work on next to contribute further?
Le mar. 27 janv. 2026 à 11:11, Tom Dewey ***@***.***> a
écrit :
… *tdewey-rpi* left a comment (raspberrypi/rpi-imager#1481)
<#1481 (comment)>
Thanks for responding to the feedback, @Ferdinaelectro1
<https://github.com/Ferdinaelectro1>
My pleasure to merge this.
—
Reply to this email directly, view it on GitHub
<#1481 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BJN5NWLPDO4WFOROXXRGLRD4I42U5AVCNFSM6AAAAACS2DYFP6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQMBUGI4DCOJRHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Fantastic question. Honestly, you know your capabilities better than I do (hardware availability, OS availability, proficiency), so I'd suggest just taking a look at any of the open Issues and having a go. |
Added a warning message when the path provided to --log-file exceeds the buffer size,
informing the user that the path will be truncated to prevent memory corruption.
This helps users notice long paths and avoids potential issues on Linux systems.