This is an automated email from the ASF dual-hosted git repository.
simbit18 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 6a1b2c690 system/nxrecorder: Fix null pointer dereference in argument
parsing
6a1b2c690 is described below
commit 6a1b2c69035ee1ad54b366586d34f64ebb406f22
Author: wangjianyu3 <[email protected]>
AuthorDate: Wed Mar 18 11:15:45 2026 +0800
system/nxrecorder: Fix null pointer dereference in argument parsing
When a command has no arguments (e.g., 'q', 'quit', 'stop'), the strtok_r()
function returns NULL for the arg parameter. The argument trimming loop was
dereferencing this NULL pointer without checking, causing undefined behavior
and system hang on ESP32-S3.
This commit adds a null check before dereferencing the arg pointer in the
leading space trimming loop.
Tested on ESP32-S3 (lckfb-szpi-esp32s3) - quit command now works correctly.
Signed-off-by: wangjianyu3 <[email protected]>
---
system/nxrecorder/nxrecorder_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/nxrecorder/nxrecorder_main.c
b/system/nxrecorder/nxrecorder_main.c
index 8ba3ad4b4..a8a4c63d6 100644
--- a/system/nxrecorder/nxrecorder_main.c
+++ b/system/nxrecorder/nxrecorder_main.c
@@ -588,7 +588,7 @@ int main(int argc, FAR char *argv[])
/* Remove leading spaces from arg */
- while (*arg == ' ')
+ while (arg && *arg == ' ')
{
arg++;
}