aboutsummaryrefslogtreecommitdiff
path: root/utf8.h
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2013-11-06 08:49:11 +1000
committerSteve Bennett <steveb@workware.net.au>2013-11-06 08:55:15 +1000
commita077f0800f5bbc7ca5f3b368726f7d1757c16549 (patch)
treed1f32c6dfaf29df2cd2a2663ba99537af59b8c26 /utf8.h
parent91960fb0e584579c5dc25376b5bfba8c6eafa4a3 (diff)
downloadjimtcl-a077f0800f5bbc7ca5f3b368726f7d1757c16549.zip
jimtcl-a077f0800f5bbc7ca5f3b368726f7d1757c16549.tar.gz
jimtcl-a077f0800f5bbc7ca5f3b368726f7d1757c16549.tar.bz2
Fix [string tolower] buffer overflow for non-utf8
Reported-by: Andy <jimdevel@hummypkg.org.uk> Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'utf8.h')
-rw-r--r--utf8.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/utf8.h b/utf8.h
index 71fd6ff..4dc5a02 100644
--- a/utf8.h
+++ b/utf8.h
@@ -26,6 +26,7 @@ int utf8_fromunicode(char *p, unsigned uc);
/* No utf-8 support. 1 byte = 1 char */
#define utf8_strlen(S, B) ((B) < 0 ? strlen(S) : (B))
#define utf8_tounicode(S, CP) (*(CP) = (unsigned char)*(S), 1)
+#define utf8_getchars(CP, C) (*(CP) = (C), 1)
#define utf8_upper(C) toupper(C)
#define utf8_title(C) toupper(C)
#define utf8_lower(C) tolower(C)
@@ -35,6 +36,9 @@ int utf8_fromunicode(char *p, unsigned uc);
#else
#if !defined(JIM_BOOTSTRAP)
+
+#define utf8_getchars utf8_fromunicode
+
/**
* Returns the length of the utf-8 sequence starting with 'c'.
*