summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2010-02-24 00:13:08 -0800
committerKaz Kylheku <kaz@kylheku.com>2010-02-24 00:13:08 -0800
commit647ec2123df81073de01a1799393fb1dbf738c29 (patch)
treeda24d1299365778651a1371445e09ad1f9b946e9 /lib.c
parent8679f74687ce18576026d48ec4ca5a37c084e0e8 (diff)
downloadtxr-647ec2123df81073de01a1799393fb1dbf738c29.tar.gz
txr-647ec2123df81073de01a1799393fb1dbf738c29.tar.bz2
txr-647ec2123df81073de01a1799393fb1dbf738c29.zip
* lib.c (init_str): Bugfix: copy only len characters, not len + 1, so
that we don't clobber the null terminator in the target string, or try read past the end of the source data. This affects the @(freeform) directive.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index 30d7b661..3135d57f 100644
--- a/lib.c
+++ b/lib.c
@@ -791,7 +791,7 @@ val mkustring(val len)
val init_str(val str, const wchar_t *data)
{
- wmemcpy(str->st.str, data, c_num(str->st.len) + 1);
+ wmemcpy(str->st.str, data, c_num(str->st.len));
return str;
}