Commit Graph
44 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 0a778a13ff HLE: Check more guest buffers by their full length, and an empty insert
Calls that checked one byte of a game's buffer and then wrote or read the
whole thing, or trusted a negative length:
- sceNetEtherNtostr/Strton, the apctl BSS descriptor calls, GetState and
  sceNetGetDropRate.
- sceNpAuthGetTicket wrote its whole ticket whatever the length; it's
  now built locally and written once the buffer is known to hold it.
  sceNpAuthGetTicketParam checked its limits after copying, and walked
  ticket params past the ticket's end.
- sceNp2's communication ID and passphrase, a negative maxServerIds, and
  an unchecked unknown1Ptr.
- sceParseUri's work area and scheme string, sceParseHttp's negative
  header length and value address, and ReadVariableSizedStruct's size.
- sceKernelCreateLwMutex initialized the work area without checking it
  at all, and the other LwMutex calls checked one byte of it.
- sceNetAdhocctlGetScanInfo cleared the length the game gave, of a
  buffer checked by one byte (or any length, negative ones included).

Also: a game mode join inserted at begin() + 1 into a possibly empty
list of players.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:26:03 +01:00
Henrik RydgårdandClaude Opus 5.5 455209b43e Net: Fix use-after-pop, the resolver after loads, inet sockaddr/poll
- The apctl, NpAuth and NpMatching2 event loops kept references to the
  front of their deque after popping it, so callbacks could get the
  next event's arguments. NpMatching2 also dereferenced its optional
  opt param when it was null.
- The resolver was left stopped after any savestate load or reboot,
  which broke Outrun 2006 (it relies on it starting out running).
- Getpeername/Getsockname with a namelen under 2 copied a negative size.
  They now write the PSP's 16-byte sockaddr truncated to namelen, with
  sa_len 16, as pspautotests net/inet/poll shows on hardware.
- Poll handed an fd that isn't open (-1) to FD_SET. It now reports
  POLLNVAL for it and counts it, as on hardware (net/inet/poll).
  Setsockopt read past a local u32 for larger options, and passed a
  negative optlen to the host. A zero cmsg_len looped forever.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 08:43:28 +01:00
Henrik Rydgård c5e4d0d90d Rename the get-memory-pointer functions to make it clear where CPU exceptions can happen. 2026-08-12 14:06:16 +02:00
Henrik Rydgård 0596ee97f6 More memory access cleanup 2026-08-11 20:14:01 +02:00
Henrik Rydgård 3c81d6b121 More manual Read_U32 cleanup
Buildfix
2026-08-11 10:28:36 +02:00
Henrik Rydgård 4e25f44eef Rename some module-related functions to include HLE where appropriate 2025-03-31 11:17:50 +02:00
Henrik Rydgård 5ffd9a2d72 Reset Np state on init, this was missing. 2025-01-21 17:41:53 +01:00
Henrik Rydgård 7d2ad6980e Another batch of changes 2025-01-20 12:20:21 +01:00
Henrik Rydgård 67e97c20fb More log refactor 2025-01-19 17:14:31 +01:00
Henrik Rydgård 28d8faef3a Integrate the sceUtility DNS query with the auto conf system, minor cleanups 2025-01-13 12:31:02 +01:00
Henrik Rydgård b13987e233 Move some code out from sceNet into sceNp and sceNp2 2025-01-09 09:06:23 +01:00
Henrik Rydgård baf6bcc41e Hide the "Not supported" notice. Minor cleanups 2025-01-08 09:24:32 +01:00
Henrik Rydgård 6922483460 Change Np country code to 'us' 2025-01-08 09:09:56 +01:00
Henrik Rydgård 6ebbb434e4 Restrict username minimum length too (3 chars) 2025-01-07 18:09:19 +01:00
Henrik Rydgård 01b06b76c9 Infrastructure username handling: Add separate username, pick Nickname as default if valid. 2025-01-07 17:43:02 +01:00
Henrik Rydgård 385b7886e2 Minor address-sanitizer cleanups 2025-01-06 18:06:21 +01:00
Henrik Rydgård 23bc115e93 Better DNS server default 2025-01-06 14:48:28 +01:00
Henrik Rydgård c8da841c3e Leave 32 bytes of space in the ticket for names, and make sure they're just 16 chars long. 2025-01-06 08:33:56 +01:00
Henrik Rydgård 504eadc337 sceNp: Allow for 16-character usernames (do not insert null) 2025-01-05 23:43:44 +01:00
Henrik Rydgård 3e98f16e6b static-ify a bunch of functions 2025-01-05 23:43:44 +01:00
Henrik Rydgård 2edc3085a5 PSPPointer<>: Replace some fiddly memsets with use of a new FillWithZero function. 2025-01-05 23:43:41 +01:00
Henrik Rydgård cf0c0dab0a Add some known function hashes to the sceNpService table 2025-01-05 22:46:58 +01:00
Henrik Rydgård f96c52b7f8 sceNpAuthGetTicket: Truncate the username at 16 chars
As requested by ChaCheeChoo in #19814
2025-01-05 22:33:44 +01:00
Henrik Rydgård e01ca5b057 Logging API change (refactor) (#19324)
* Rename LogType to Log

* Explicitly use the Log:: enum when logging. Allows for autocomplete when editing.

* Mac/ARM64 buildfix

* Do the same with the hle result log macros

* Rename the log names to mixed case while at it.

* iOS buildfix

* Qt buildfix attempt, ARM32 buildfix
2024-07-14 14:42:59 +02:00
Unknown W. Brackets 8f96405ee5 Net: Remove usage of Memory::WriteStruct().
This also validates pointer write size better.
2022-09-03 10:44:11 -07:00
Unknown W. Brackets bdb4107014 Net: Cleanup initialization syntax. 2022-08-13 12:43:14 -07:00
ANR2ME 3b7a33ddd8 Prefer using "%04x" over "%04hx". 2022-08-06 11:04:07 +07:00
ANR2ME 48deb37cc8 Fix logging warning issue. 2022-08-06 03:11:59 +07:00
ANR2ME 4c9e1dec1a Fix include issue. 2022-08-04 16:35:30 +07:00
ANR2ME 865959d420 Replace the dummy PSN name with Nickname on sceNpInit. 2022-08-04 16:12:31 +07:00
ANR2ME 41de63f13c Moving sceNpMatching2-stuff to sceNp2.cpp/h.
PS: Register_sceNpMatching2 not being added to HLETables because currently the callback didn't work properly yet and could crash the game.
2022-08-04 16:12:29 +07:00
ANR2ME 54300eb017 Updated NP Library
PS: Some of registered modules should probably moved to a separate files (ie. sceNp2.cpp).
2022-08-04 16:12:23 +07:00
Henrik Rydgård e6403d7157 Split GetPointer into two versions, to help with const correctness 2022-07-24 13:26:19 +02:00
ANR2ME d99f55465e Fixed possible crash issue due to lingering leftover callback events from previous multiplayer session. 2020-09-04 02:39:00 +07:00
ANR2ME 2620957aba An attempt to simulate a fake PSN authentication on Patapon 3 2020-08-12 21:16:01 +07:00
ANR2ME 92db25e486 Renaming sceNp* NIDs functions to their proper function names. 2020-08-12 20:27:03 +07:00
Unknown W. Brackets fcf0518223 Update all the HLE tables with arg and ret info. 2015-03-22 20:51:55 -07:00
Lioncash 4ccb838306 Core: Mark some module functions as static 2014-12-08 04:40:08 -05:00
Unknown W. Brackets 05ab192c9c Reduce includes in Core/HLE/.
Especially templates.
2014-03-15 11:22:19 -07:00
shenweip 6e56e33625 Fix wrong logging. 2013-12-12 13:16:08 +08:00
shenweip 9bc534d54a Wrap some empty functions. 2013-11-14 22:43:00 +08:00
mattweb28 d3ded6639a Added sceJpeg & sceMd5 2013-05-15 19:49:34 +08:00
nachume 55b94900a0 UNIMPL functions replace DEBUG_LOG -> ERROR_LOG 2013-04-29 14:16:55 +09:00
nachume c2c6adb7c9 Add new sceNp/scePauth and some stubs for unknown functions on THE IDOLM@STER SP. 2013-04-29 12:40:09 +09:00