Skip to content

mod_commands: fix nullptr crash in uuid_record when argc=4#3001

Open
jack3z wants to merge 2 commits into
signalwire:masterfrom
jack3z:fix/mod_commands-uuid-record-nullptr
Open

mod_commands: fix nullptr crash in uuid_record when argc=4#3001
jack3z wants to merge 2 commits into
signalwire:masterfrom
jack3z:fix/mod_commands-uuid-record-nullptr

Conversation

@jack3z

@jack3z jack3z commented Apr 3, 2026

Copy link
Copy Markdown

Description

This PR fixes a null pointer crash in mod_commands.c when executing the uuid_record API command.

The bug was caused by an incorrect argument count check:

  • Original code used if (argc > 3) and accessed argv[4] directly
  • When argc == 4, argv[4] is NULL, passing a null pointer to switch_url_decode()
  • This leads to an immediate crash in switch_url_decode at src/switch_utils.c:3540

Fix: Changed the condition from argc > 3 to argc > 4 to ensure argv[4] is valid before accessing it.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Code cleanup / refactor

Related Issues

No existing issue reported; this bug was discovered via production crash stack trace.

Testing

  • Added/updated unit tests
  • Tested manually
  • Tested with live SignalWire credentials (if applicable)

Manual testing verification:

  1. Test uuid_record with 4 arguments (argc=4) → No crash, works safely
  2. Test uuid_record with 5 arguments (argc=5) → Functions as expected
  3. Verified the original crash scenario no longer occurs

Checklist

  • I have read the CONTRIBUTING guidelines
  • My code follows the project's style guidelines
  • I have added tests for my changes (if applicable)
  • I have updated documentation (if applicable)
  • All existing tests pass

Additional Notes

Crash stack trace:

@jack3z

jack3z commented Apr 3, 2026

Copy link
Copy Markdown
Author

Additional Notes

Crash stack trace:
#0 0x00007f334319da2f in switch_url_decode (s=0x0) at src/switch_utils.c:3540
#1 0x00007f33333ea0ec in session_record_function at mod_commands.c:4710

This is a critical stability fix for production environments using uuid_record.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant