fix(npmanager): validate null output pointers #7597

Merged
voidlakhan merged 1 commit from upstream-pr/7597 into main 2026-10-19 23:15:53 +00:00
voidlakhan commented 2026-10-18 16:27:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by voidlakhan on 2026-10-18T16:27:01Z.


What

sceNpGetOnlineId and sceNpGetAccountCountryA unconditionally returned SCE_NP_ERROR_SIGNED_OUT (0x80550006) without validating their destination pointers, ignoring null arguments.

Both functions now validate their output buffer pointers and return SCE_NP_ERROR_INVALID_ARGUMENT (0x80550003) when passed nullptr, matching the existing null-pointer validation pattern used by sibling libSceNpManager APIs (sceNpGetNpId, sceNpGetAccountAge, sceNpGetState, sceNpGetUserIdByAccountId).

Added regression tests in GuestNpManager.cpp covering null argument rejection and preserving unmodified output buffers in signed-out state.

Tested

  • guest_np_manager_tests: 1/1 tests passed.
  • python tools/check_conventions.py --base upstream/main: passed.
  • git diff --check: passed.

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
  • 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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4910776204 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7597). Originally posted by [voidlakhan](https://github.com/voidlakhan) on 2026-10-18T16:27:01Z. --- ### What `sceNpGetOnlineId` and `sceNpGetAccountCountryA` unconditionally returned `SCE_NP_ERROR_SIGNED_OUT` (`0x80550006`) without validating their destination pointers, ignoring null arguments. Both functions now validate their output buffer pointers and return `SCE_NP_ERROR_INVALID_ARGUMENT` (`0x80550003`) when passed `nullptr`, matching the existing null-pointer validation pattern used by sibling `libSceNpManager` APIs (`sceNpGetNpId`, `sceNpGetAccountAge`, `sceNpGetState`, `sceNpGetUserIdByAccountId`). Added regression tests in `GuestNpManager.cpp` covering null argument rejection and preserving unmodified output buffers in signed-out state. ### Tested - `guest_np_manager_tests`: 1/1 tests passed. - `python tools/check_conventions.py --base upstream/main`: passed. - `git diff --check`: passed. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-18 16:36:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T16:36:56Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6044 core/libs/tests/GuestNpManager.cpp
PR 6977 core/libs/prx/libSceNpManager/Export.cpp
PR 6990 core/libs/prx/libSceNpManager/Export.cpp
core/libs/tests/GuestNpManager.cpp
PR 7412 core/libs/prx/libSceNpManager/Export.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6252383890 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7597#issuecomment-6252383890). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-18T16:36:56Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestNpManager.cpp` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libSceNpManager/Export.cpp` | | [PR 6990](https://www.github.com/boykopovar/AnyPS5/pull/6990) | `core/libs/prx/libSceNpManager/Export.cpp`<br>`core/libs/tests/GuestNpManager.cpp` | | [PR 7412](https://www.github.com/boykopovar/AnyPS5/pull/7412) | `core/libs/prx/libSceNpManager/Export.cpp` |
voidlakhan commented 2026-10-18 16:48:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by voidlakhan on 2026-10-18T16:48:45Z.


Checked the shared files with the referenced pull requests:

  • PR #6990 (core/libs/tests/GuestNpManager.cpp): Adds tests for sceNpGetAccountIdA and sceNpGetState; does not test sceNpGetAccountCountryA or sceNpGetOnlineId.
  • PR #6044 (core/libs/tests/GuestNpManager.cpp): Reorganizes test paths into subdirectories; does not modify libSceNpManager test assertions.
  • PR #6977 (core/libs/prx/libSceNpManager/Export.cpp): Implements sceNpSetContentRestriction and messaging stubs; does not touch sceNpGetOnlineId or sceNpGetAccountCountryA.

There is no functional or export overlap with any open PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6252503790 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7597#issuecomment-6252503790). Originally posted by [voidlakhan](https://github.com/voidlakhan) on 2026-10-18T16:48:45Z. --- Checked the shared files with the referenced pull requests: - **PR #6990** (`core/libs/tests/GuestNpManager.cpp`): Adds tests for `sceNpGetAccountIdA` and `sceNpGetState`; does not test `sceNpGetAccountCountryA` or `sceNpGetOnlineId`. - **PR #6044** (`core/libs/tests/GuestNpManager.cpp`): Reorganizes test paths into subdirectories; does not modify `libSceNpManager` test assertions. - **PR #6977** (`core/libs/prx/libSceNpManager/Export.cpp`): Implements `sceNpSetContentRestriction` and messaging stubs; does not touch `sceNpGetOnlineId` or `sceNpGetAccountCountryA`. There is no functional or export overlap with any open PR.
adriadam10 commented 2026-10-19 23:19:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T23:19:16Z.


Checked against shadPS4 (null output pointer returns INVALID_ARGUMENT before the signed-out check in both functions) and the new test pins null -> INVALID_ARGUMENT and untouched output; merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6279496388 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7597#issuecomment-6279496388). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T23:19:16Z. --- Checked against shadPS4 (null output pointer returns INVALID_ARGUMENT before the signed-out check in both functions) and the new test pins null -> INVALID_ARGUMENT and untouched output; merged.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!7597
No description provided.