commit e7eee2b7926668360a0d8e2abee6c35a00ebce3c
Author: Christian Egli <christian.egli@sbs.ch>
Date:   Mon Jun 4 12:02:13 2018 +0200

    Fix yet another buffer overflow in the braille table parser
    
    Reported by Henri Salo
    
    Fixes #591

diff --git a/liblouis/compileTranslationTable.c b/liblouis/compileTranslationTable.c
index ced0a67b..b6577c7c 100644
--- a/liblouis/compileTranslationTable.c
+++ b/liblouis/compileTranslationTable.c
@@ -1153,12 +1153,12 @@ parseChars(FileInfo *nested, CharsString *result, CharsString *token) {
 			}
 			utf32 = (utf32 << 6) + (token->chars[in++] & 0x3f);
 		}
-		if (CHARSIZE == 2 && utf32 > 0xffff) utf32 = 0xffff;
-		result->chars[out++] = (widechar)utf32;
 		if (out >= MAXSTRING) {
 			result->length = lastOutSize;
 			return 1;
 		}
+		if (CHARSIZE == 2 && utf32 > 0xffff) utf32 = 0xffff;
+		result->chars[out++] = (widechar)utf32;
 	}
 	result->length = out;
 	return 1;
commit d4fc803687e38a5355fb686bf98cc082951f3043
Author: Christian Egli <christian.egli@sbs.ch>
Date:   Mon Jun 4 13:51:26 2018 +0200

    Use a standard buffer size for translating
    
    I believe this fixes #591 (the second part of of it)

diff --git a/tools/lou_translate.c b/tools/lou_translate.c
index 6735003e..2f6e70e9 100644
--- a/tools/lou_translate.c
+++ b/tools/lou_translate.c
@@ -33,8 +33,6 @@
 #include "unistr.h"
 #include "version-etc.h"
 
-#define BUFSIZE MAXSTRING - 4
-
 static int forward_flag = 0;
 static int backward_flag = 0;
 
@@ -53,20 +51,20 @@ const char version_etc_copyright[] =
 
 static void
 translate_input(int forward_translation, char *table_name) {
-	char charbuf[BUFSIZE];
+	char charbuf[MAXSTRING];
 	uint8_t *outputbuf;
 	size_t outlen;
-	widechar inbuf[BUFSIZE];
-	widechar transbuf[BUFSIZE];
+	widechar inbuf[MAXSTRING];
+	widechar transbuf[MAXSTRING];
 	int inlen;
 	int translen;
 	int k;
 	int ch = 0;
 	int result;
 	while (1) {
-		translen = BUFSIZE;
+		translen = MAXSTRING;
 		k = 0;
-		while ((ch = fgetc(input)) != '\n' && ch != EOF && k < BUFSIZE - 1)
+		while ((ch = fgetc(input)) != '\n' && ch != EOF && k < MAXSTRING - 1)
 			charbuf[k++] = ch;
 		if (ch == EOF && k == 0) break;
 		charbuf[k] = 0;
