diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-s-parser.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index ce216fd8e..c6cf1b32d 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -423,7 +423,10 @@ public: if (dot) { // type.operation (e.g. i32.add) WasmType type = stringToWasmType(str, false, true); - const char *op = dot + 1; + // Local copy to index into op without bounds checking. + constexpr size_t maxNameSize = 15; + char op[maxNameSize + 1] = { '\0' }; + strncpy(op, dot + 1, maxNameSize); switch (op[0]) { case 'a': { if (op[1] == 'b') return makeUnary(s, UnaryOp::Abs, type); |