aboutsummaryrefslogtreecommitdiff
path: root/src/wasmrt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasmrt.c')
-rw-r--r--src/wasmrt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wasmrt.c b/src/wasmrt.c
index 8730c14..6ec73fd 100644
--- a/src/wasmrt.c
+++ b/src/wasmrt.c
@@ -145,7 +145,9 @@ size_t wasm_rt_memory_loada_unchecked(struct wasm_rt_memory_t const *mem,
return i;
}
}
- buf[sz - 1] = '\0';
+ if (sz) {
+ buf[sz - 1] = '\0';
+ }
return sz;
}