agent: Fix alignment problem with the second passphrase struct.
authorWerner Koch <wk@gnupg.org>
Thu, 1 Oct 2015 11:21:25 +0000 (13:21 +0200)
committerNIIBE Yutaka <gniibe@fsij.org>
Mon, 5 Oct 2015 17:11:00 +0000 (02:11 +0900)
commitcaa555a5bfaa98f8f630901427a653bd8dc7b95e
tree678d6defafd775e1c4b0148140973d8ec0d33919
parentb1653a4083b91cfa85d90f59612fa1c3f4d51778
agent: Fix alignment problem with the second passphrase struct.

* agent/genkey.c (agent_ask_new_passphrase): Use a separate malloc for
PI2.  Check return value of the malloc function.
* agent/command-ssh.c (ssh_identity_register): Use a separate malloc
for PI2.  Wipe PI2.
--

For whatever stupid reasons I once allocated only one memory area and
split that into PI and PI2.  This is actually a common pattern with
malloc but here we used a made up object size and do not take the
extra alignment required into account.  One of these not yet hit by
a (sig)bus PC/VAX hacker bugs.

Instead of trying to fix the alignment, it is better to use a second
calloc for the second struct.

GnuPG-bug-id: 2112
Signed-off-by: Werner Koch <wk@gnupg.org>
Resolved conflicts:
agent/command-ssh.c
agent/genkey.c

(backport master commit ddf9dd135acd2b3635bb986f6dfc0e4e446d5fad)
agent/command-ssh.c
agent/genkey.c