From: Mike Pall Date: Mon, 24 Jan 2011 14:51:33 +0000 (+0100) Subject: FFI: Don't force zero terminator on string to array conversion. X-Git-Tag: v2.0.0-beta6~51 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=705f593ffc91ecfc42f0de81b86fe4a6c3097958;p=thirdparty%2FLuaJIT.git FFI: Don't force zero terminator on string to array conversion. --- 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, CTSize sz = str->len+1; if (!ctype_isinteger(dc->info) || dc->size != 1) goto err_conv; - if (d->size != 0 && d->size < sz) { - sz = d->size-1; - dp[sz] = '\0'; - } + if (d->size != 0 && d->size < sz) + sz = d->size; memcpy(dp, strdata(str), sz); return; } else { /* Otherwise pass it as a const char[]. */