diff options
author | Mike Pall <mike> | 2011-01-24 15:51:33 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-01-24 15:51:33 +0100 |
commit | 705f593ffc91ecfc42f0de81b86fe4a6c3097958 (patch) | |
tree | 82b8f2161ac842a4908b04debb360700b51743c6 /src | |
parent | 96ef87bdfdc6000e6ae3a5fe5804922885d55c55 (diff) | |
download | luajit-705f593ffc91ecfc42f0de81b86fe4a6c3097958.tar.gz luajit-705f593ffc91ecfc42f0de81b86fe4a6c3097958.tar.bz2 luajit-705f593ffc91ecfc42f0de81b86fe4a6c3097958.zip |
FFI: Don't force zero terminator on string to array conversion.
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_cconv.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/lj_cconv.c b/src/lj_cconv.c index d4578f88..1e6df8d8 100644 --- a/src/lj_cconv.c +++ b/src/lj_cconv.c | |||
@@ -545,10 +545,8 @@ void lj_cconv_ct_tv(CTState *cts, CType *d, | |||
545 | CTSize sz = str->len+1; | 545 | CTSize sz = str->len+1; |
546 | if (!ctype_isinteger(dc->info) || dc->size != 1) | 546 | if (!ctype_isinteger(dc->info) || dc->size != 1) |
547 | goto err_conv; | 547 | goto err_conv; |
548 | if (d->size != 0 && d->size < sz) { | 548 | if (d->size != 0 && d->size < sz) |
549 | sz = d->size-1; | 549 | sz = d->size; |
550 | dp[sz] = '\0'; | ||
551 | } | ||
552 | memcpy(dp, strdata(str), sz); | 550 | memcpy(dp, strdata(str), sz); |
553 | return; | 551 | return; |
554 | } else { /* Otherwise pass it as a const char[]. */ | 552 | } else { /* Otherwise pass it as a const char[]. */ |