gentranslit: Fix buffer overrun.
diff --git a/ChangeLog b/ChangeLog
index 4916e53..bdcab0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-03-31 Bruno Haible <bruno@clisp.org>
+
+ gentranslit: Fix buffer overrun.
+ * lib/gentranslit.c (main): Allocate more room for the suffix strings
+ of the translit pages.
+ Reported by Ben Noordhuis <info@bnoordhuis.nl>.
+
2011-02-28 Bruno Haible <bruno@clisp.org>
* lib/relocatable.h: Update from gnulib.
diff --git a/lib/gentranslit.c b/lib/gentranslit.c
index 8cd5204..0b2779c 100644
--- a/lib/gentranslit.c
+++ b/lib/gentranslit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2003, 2005, 2011 Free Software Foundation, Inc.
This file is part of the GNU LIBICONV Library.
The GNU LIBICONV Library is free software; you can redistribute it
@@ -183,11 +183,11 @@
if (tables[t].usecount > 1) {
char* s;
if (p == tables[t].minline >> 5) {
- s = (char*) malloc(5+1);
+ s = (char*) malloc(4+1+2+1);
sprintf(s, "%02x_%d", p, ++i);
} else {
p = tables[t].minline >> 5;
- s = (char*) malloc(2+1);
+ s = (char*) malloc(4+1);
sprintf(s, "%02x", p);
}
tables[t].suffix = s;