1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-03-12 23:01:14 +01:00

gpg: Fix type mismatch resulting in a buffer overflow.

* g10/tofu.c (record_binding): Change policy_old's type from an enum
tofu_policy to a long: this variable is passed by reference and a long
is expected.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Reported-by: Justus Winter <justus@g10code.com>
Fixes-commit: f77913e
This commit is contained in:
Neal H. Walfield 2015-12-02 15:20:18 +01:00
parent 28e2513721
commit c73d75103c

View File

@ -1079,7 +1079,10 @@ record_binding (struct dbs *dbs, const char *fingerprint, const char *email,
struct db *db_email = NULL, *db_key = NULL;
int rc;
char *err = NULL;
enum tofu_policy policy_old = TOFU_POLICY_NONE;
/* policy_old needs to be a long and not an enum tofu_policy,
because we pass it by reference to get_single_long_cb2, which
expects a long. */
long policy_old = TOFU_POLICY_NONE;
if (! (policy == TOFU_POLICY_AUTO
|| policy == TOFU_POLICY_GOOD