On Mon, 27 Nov 2006, Werner Koch wrote: > GnuPG 1.4 and 2.0 buffer overflow > ================================== [snip] > > The code in question has been introduced on July 1, 1999 and is a > pretty obvious bug. make_printable_string is supposed to replace > possible dangerous characters from a prompt and returns a malloced > string. Thus this string may be longer than the orginal one; the > buffer for the prompt has only be allocated at the size of the original > string - oops. Note, that using snprintf would not have helped in > this case. How I wish C-90 had introduced asprintf or at least it > would be available on more platforms. I think that this is a classic case of a security problem introduced by attempting to code for the "lowest common denominator" rather than picking the best API (or the one most conducive to security) and coding to that. Why not just pull an asprintf() implementation into gnupg? You can get a free (MIT licensed) one from OpenSSH's portability code, and I'm sure it is not the only one. -d