Fix potential heap corruption in "gpg -v --version"
authorWerner Koch <wk@gnupg.org>
Sat, 15 Dec 2012 10:28:00 +0000 (11:28 +0100)
committerWerner Koch <wk@gnupg.org>
Sat, 15 Dec 2012 10:28:00 +0000 (11:28 +0100)
commite33e74e3a4b2b4a0341f933410ddd5db7a12515e
tree3b84b86b658893f106a15c32e07091e141dc2fc9
parenteb541e35b80e5864bf7264157091afee3c4a8bfd
Fix potential heap corruption in "gpg -v --version"

* g10/gpg.c (build_list): Rewrite to cope with buffer overflow in
certain locales.
* util/membuf.c (put_membuf_str): New.
(get_membuf): Make LEN optional.
--

This fixes an obvious bug in locales where the translated string is
longer than the original.  The bug could be exhibited by using
LANG=ru_RU.utf8 gpg -v --version.

En passant we also removed the trailing white space on continued
lines.

Reported-by: Dmitry V. Levin" <ldv at altlinux.org>
THANKS
g10/gpg.c
include/util.h
util/membuf.c