ViezeVingertjes opened a new pull request, #4156:
URL: https://github.com/apache/nuttx-apps/pull/4156
## Summary
strtok_r() may set the save pointer to NULL when the token ends the
string (POSIX leaves its value unspecified, and e.g. the newlib
implementation in the ESP32-S3 ROM does so). nxplayer then
dereferenced it while skipping leading spaces, so any command without
an argument, such as "q" or "stop", crashed with a NULL pointer load.
Check arg for NULL before dereferencing it, as nxrecorder already does.
Tested on Waveshare ESP32-S3-Touch-AMOLED-2.16: "q" crashed with
LoadProhibited (EXCVADDR 0x0 in nxplayer_main) before, exits cleanly
after.
## Impact
* Is new feature added? Is existing feature changed? NO
* Impact on user (will user need to adapt to change)? NO
* Impact on build (will build process change)? NO
* Impact on hardware (will arch(s) / board(s) / driver(s) change)? NO
* Impact on documentation (is update required / provided)? NO
* Impact on security (any sort of implications)? NO
* Impact on compatibility (backward/forward/interoperability)? NO
## Testing
I confirm that changes are verified on local setup and works as intended:
* Build Host(s): Linux x86_64, xtensa-esp-elf GCC 15.2.0
(esp-15.2.0_20251204), riscv32-esp-elf GCC 15.2.0 for the ESP32-C3 build.
* Target(s): Waveshare ESP32-S3-Touch-AMOLED-2.16 (ESP32-S3R8, 16 MB flash,
8 MB PSRAM).
* nxplayer commands without arguments ("q", "stop").
Builds (each on current master plus this PR only):
* PASS pr/nxplayer-noarg korvo esp32s3-korvo-2:audio (warnings: 0)
Testing logs before change:
```
LoadProhibited exception (EXCVADDR 0x0 in nxplayer_main) on "q".
```
Testing logs after change:
```
"q" and "stop" work.
```
## PR verification Self-Check
* [x] This PR introduces only one functional change.
* [x] I have updated all required description fields above.
* [x] My PR adheres to Contributing Guidelines and Documentation (git commit
title and message, coding standard, etc).
* [ ] My PR is still work in progress (not ready for review).
* [x] My PR is ready for review and can be safely merged into a codebase.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]