Skip to content

fix(libSceAmpr): safely probe the name of _Cnd_init_with_name - #20684

Closed
milescoviello wants to merge 1 commit into
boykopovar:mainfrom
milescoviello:fix/ampr-probe-cnd-init-name
Closed

milescoviello wants to merge 1 commit into
boykopovar:mainfrom
milescoviello:fix/ampr-probe-cnd-init-name

Conversation

@milescoviello

@milescoviello milescoviello commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What

_Cnd_init_with_name (as libSceAmpr exports it) ran strlen over the name straight through the guest pointer to enforce its 31-character limit, so a non-null name pointing at unmapped memory faulted the host.

The name is now copied with CopyGuestString_nid_no_patch capped at 32 bytes. That gives the same answers as the strlen check: up to 31 characters fit, and 32 or more come back as "no terminator in 32 bytes" and still return thrd_error (4) with errno 63. An unreadable name returns thrd_error with errno 14 (EFAULT), the same failure shape, without creating the condition. The null and empty names, the null-handle throw and the conditions created for valid names are unchanged.

The debt entry goes in a fragment under docs/dev/debt/changes/ and records this as unmeasured.

Tested

Linux (Ubuntu 26.04.1), GCC 15.2, Release.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milescoviello

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #20633 (PrivacyOnion), opened an hour earlier, which already replaces the strlen in _Cnd_init_with_name with a checked copy. My dedupe snapshot predated it. Sorry for the noise.

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