Skip to content

Commit 347ec12

Browse files
committed
gentranslit: Fix buffer overrun.
1 parent 5124ded commit 347ec12

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2011-03-31 Bruno Haible <bruno@clisp.org>
2+
3+
gentranslit: Fix buffer overrun.
4+
* lib/gentranslit.c (main): Allocate more room for the suffix strings
5+
of the translit pages.
6+
Reported by Ben Noordhuis <info@bnoordhuis.nl>.
7+
18
2011-02-28 Bruno Haible <bruno@clisp.org>
29

310
* lib/relocatable.h: Update from gnulib.

lib/gentranslit.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 1999-2003, 2005 Free Software Foundation, Inc.
1+
/* Copyright (C) 1999-2003, 2005, 2011 Free Software Foundation, Inc.
22
This file is part of the GNU LIBICONV Library.
33
44
The GNU LIBICONV Library is free software; you can redistribute it
@@ -183,11 +183,11 @@ int main (int argc, char *argv[])
183183
if (tables[t].usecount > 1) {
184184
char* s;
185185
if (p == tables[t].minline >> 5) {
186-
s = (char*) malloc(5+1);
186+
s = (char*) malloc(4+1+2+1);
187187
sprintf(s, "%02x_%d", p, ++i);
188188
} else {
189189
p = tables[t].minline >> 5;
190-
s = (char*) malloc(2+1);
190+
s = (char*) malloc(4+1);
191191
sprintf(s, "%02x", p);
192192
}
193193
tables[t].suffix = s;

0 commit comments

Comments
 (0)