summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ffi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ffi.c b/ffi.c
index d194a9bf..6c831246 100644
--- a/ffi.c
+++ b/ffi.c
@@ -1070,8 +1070,8 @@ static void ffi_array_put(struct txr_ffi_type *tft, val vec, mem_t *dst,
val eltype = tft->mtypes;
struct txr_ffi_type *etft = ffi_type_struct(eltype);
cnum elsize = etft->size;
- cnum i, nelem = if3(tft->is_varray, c_num(length(vec)), tft->nelem);
int nt = tft->null_term;
+ cnum i, nelem = if3(tft->is_varray, c_num(length(vec)) + nt, tft->nelem);
ucnum offs = 0;
for (i = 0; i < nelem; i++) {
@@ -1092,8 +1092,8 @@ static void ffi_array_out(struct txr_ffi_type *tft, int copy, val vec,
val eltype = tft->mtypes;
struct txr_ffi_type *etft = ffi_type_struct(eltype);
cnum elsize = etft->size;
- cnum i, nelem = if3(tft->is_varray, c_num(length(vec)), tft->nelem);
int nt = tft->null_term;
+ cnum i, nelem = if3(tft->is_varray, c_num(length(vec)) + nt, tft->nelem);
ucnum offs = 0;
for (i = 0; i < nelem; i++) {