From 52ba5e67cad4311d0ddbc4f2979e20afd0161d1f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 31 Mar 2017 20:06:54 +0200 Subject: gpg: Assert that an opaque parameter is really what we expect. * g10/gpg.h (SERVER_CONTROL_MAGIC): New const. (server_control_s): Add field 'magic'. * g10/gpg.c (gpg_init_default_ctrl): Init MAGIC. * g10/import.c (impex_filter_getval): Assert MAGIC. Signed-off-by: Werner Koch --- g10/import.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'g10/import.c') diff --git a/g10/import.c b/g10/import.c index abc811d63..54d649b34 100644 --- a/g10/import.c +++ b/g10/import.c @@ -1182,6 +1182,8 @@ impex_filter_getval (void *cookie, const char *propname) static char numbuf[20]; const char *result; + log_assert (ctrl && ctrl->magic == SERVER_CONTROL_MAGIC); + if (node->pkt->pkttype == PKT_USER_ID || node->pkt->pkttype == PKT_ATTRIBUTE) { -- cgit v1.2.3