Merge pull request #15 from obelisk-complex/fix/sscanf-signedness-and-substr-copy

fix: correct sscanf %x signedness and avoid a substr copy
- `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)`.
This commit is contained in:
boykopovar
2026-09-27 11:30:50 +03:00
committed by GitHub
2 changed files with 4 additions and 4 deletions
@@ -44,7 +44,7 @@ inline std::string StripNidPostfix(const std::string& name) {
std::string result = name;
if (result.size() >= kNidPostfixLen &&
result.compare(result.size() - kNidPostfixLen, kNidPostfixLen, kNidPostfix) == 0) {
result = result.substr(0u, result.size() - kNidPostfixLen);
result.resize(result.size() - kNidPostfixLen);
}
const auto disambigPos = result.rfind(kNidDisambigMarker);
if (disambigPos != std::string::npos) {
@@ -54,7 +54,7 @@ inline std::string StripNidPostfix(const std::string& name) {
[](unsigned char c) { return std::isdigit(c) != 0; }
);
if (allDigits && suffixStart < result.size())
result = result.substr(0u, disambigPos);
result.resize(disambigPos);
}
return result;
}
+2 -2
View File
@@ -55,8 +55,8 @@ bool fillModuleInfoForUnwind(std::uint64_t addr, ModuleInfoForUnwind* info) {
std::uint64_t end = 0;
char perms[8] = {};
std::uint64_t offset = 0;
int devMajor = 0;
int devMinor = 0;
unsigned int devMajor = 0;
unsigned int devMinor = 0;
std::uint64_t inode = 0;
char path[4096] = {};
int parsed = std::sscanf(