Skip to content

sms_tool: make USSD response decoding robust - #24

Open
dormancygrace wants to merge 1 commit into
obsy:masterfrom
dormancygrace:agent/ussd-auto-ucs2
Open

sms_tool: make USSD response decoding robust#24
dormancygrace wants to merge 1 commit into
obsy:masterfrom
dormancygrace:agent/ussd-auto-ucs2

Conversation

@dormancygrace

Copy link
Copy Markdown

What changed

  • replace unbounded, one-line sscanf() parsing of +CUSD with a bounded parser
  • accumulate split/multiline CUSD responses before parsing
  • print already-decoded text returned by modems instead of treating it as hex
  • conservatively recognize UCS2 payloads when modem firmware reports GSM-7
  • preserve -c as an authoritative manual override
  • fix the DCS bit-test precedence bug and bound UCS2-to-UTF-8 output

Why

Issue #13 contains a valid UCS2 response reported with DCS 7 by the modem.
The old code decoded it as packed GSM-7 unless the user supplied -c 2.
The USSD part of #1 also remained limited to one-line responses, and the old
unbounded scans could overflow the 320-byte payload buffer (the sample from
#13 is already 496 hex characters).

This completes the unresolved USSD portions of #1 and #13 while keeping the
existing manual workaround available.

Validation

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