Skip to content

fix: correct sscanf %x signedness and avoid a substr copy - #15

Merged
boykopovar merged 1 commit into
boykopovar:mainfrom
obelisk-complex:fix/sscanf-signedness-and-substr-copy
Sep 27, 2026
Merged

boykopovar merged 1 commit into
boykopovar:mainfrom
obelisk-complex:fix/sscanf-signedness-and-substr-copy

Conversation

@obelisk-complex

Copy link
Copy Markdown

libSceSysmodule/Export.cpp parsed /proc/self/maps device major/minor numbers into signed int with a %x format, which is undefined behaviour per the C standard even though it happened to work on this target; switched to unsigned int to match the format specifier.

NidPatcherUtils.hpp's StripNidPostfix built a truncated copy with substr(0, n) where the prefix is already the string itself; resize(n) does the same truncation without the extra allocation and copy.

Changes

  • core/libs/prx/libSceSysmodule/Export.cpp: devMajor/devMinor now unsigned int.
  • core/libs/nid/include/nid/NidPatcherUtils.hpp: two substr(0, n) calls replaced with resize(n).

Testing (Linux, GCC)

  • Full build succeeds.
  • ctest: 23/30, the same 7 pre-existing failures as on main, unaffected by this change.

🤖 Generated with Claude Code

libSceSysmodule/Export.cpp parsed /proc/self/maps device major/minor
numbers into signed int with a %x format, which is undefined behaviour
per the C standard even though it happened to work on this target;
switched to unsigned int to match the format specifier.

NidPatcherUtils.hpp's StripNidPostfix built a truncated copy with
substr(0, n) where the prefix is already the string itself; resize(n)
does the same truncation without the extra allocation and copy.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@boykopovar
boykopovar merged commit 7894745 into boykopovar:main Sep 27, 2026
hypermoist pushed a commit to hypermoist/AnyPS5 that referenced this pull request Oct 26, 2026
…gn-in state (boykopovar#15)

* feat(bridge): observe every NP, HTTP, SSL and socket export

Every export of libSceNpManager, libSceNpEntitlementAccess,
libSceNpUniversalDataSystem, libSceNpCommerce, libSceHttp, libSceHttp2,
libSceSsl, libSceNet and libSceNetCtl now writes an observation line with
its scalar arguments and return code. URL, host, method and path
arguments are written as text. Socket binds, connects, sends and receives
add their IPv4 address, port and virtual port, and sceNetSetsockopt adds
an integer option value, so a game's LAN discovery shows in the log.
Payloads are never written.

* feat(bridge): report NP reachability from the bridge's sign-in state

With the bridge on and the initial user signed in,
sceNpGetNpReachabilityState reports reachable (2), and sceNpCheckCallback
delivers every change of that state to the reachability callback, as it
does for the state callbacks. Signed out or with the bridge off it stays
unavailable. A game that waits for reachability before hosting an online
session, such as Overcooked! All You Can Eat (PPSA01528), stopped there.

* feat(bridge): report sign-up from the bridge's sign-in state

With the bridge on and the initial user signed in, sceNpHasSignedUp reports true, because an account signed in to the network has signed up to it. Signed out, for another user or with the bridge off it stays false.

* fix(bridge): resolve the merge of main in sceNpManager

---------

Co-authored-by: AlxcBTW <187763517+AlxcBTW@users.noreply.github.com>
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.

2 participants