diff options
| author | ubiquitarianism <283527159+ubiquitarianism@users.noreply.github.com> | 2026-11-24 11:11:19 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-24 11:11:19 -0500 |
| commit | 919abedf28af2f646cd5d46df43d5578920d2793 (patch) | |
| tree | 3583421a69835f4fa2eaa4a6987cc4dde8ba8a31 /runtime/src | |
| parent | 0af7753c0a69fcd2f57438d9c52cdb0264c92e8b (diff) | |
| parent | d6ca1fdaea7458f9a854f657fb58092336b61277 (diff) | |
Merge pull request #518 from xroneyaa/fix/mods-parse-empty-hex-prefix
MODS-PARSE-HEX-PREFIX: reject bare 0x/0X prefix in parse_model_id
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/mods.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/src/mods.h b/runtime/src/mods.h index 10155bf19..bd635e9a0 100644 --- a/runtime/src/mods.h +++ b/runtime/src/mods.h | |||
| @@ -78,8 +78,8 @@ struct LoadResult { | |||
| 78 | // "0x..." -> that value; anything else -> joaat(name). Returns false for an empty name or a malformed hex value. | 78 | // "0x..." -> that value; anything else -> joaat(name). Returns false for an empty name or a malformed hex value. |
| 79 | inline bool parse_model_id(const std::string& text, uint32_t& out) { | 79 | inline bool parse_model_id(const std::string& text, uint32_t& out) { |
| 80 | if (text.empty()) return false; | 80 | if (text.empty()) return false; |
| 81 | if (text.size() > 2 && text[0] == '0' && (text[1] == 'x' || text[1] == 'X')) { | 81 | if (text.size() >= 2 && text[0] == '0' && (text[1] == 'x' || text[1] == 'X')) { |
| 82 | if (text.size() > 10) return false; | 82 | if (text.size() == 2 || text.size() > 10) return false; |
| 83 | uint32_t v = 0; | 83 | uint32_t v = 0; |
| 84 | for (std::size_t i = 2; i < text.size(); ++i) { | 84 | for (std::size_t i = 2; i < text.size(); ++i) { |
| 85 | const char c = text[i]; | 85 | const char c = text[i]; |