[svn] assuan - r349 - trunk/src
svn author wk
cvs at cvs.gnupg.org
Thu Jan 14 22:16:56 CET 2010
Author: wk
Date: 2010-01-14 22:16:55 +0100 (Thu, 14 Jan 2010)
New Revision: 349
Modified:
trunk/src/ChangeLog
trunk/src/assuan.c
trunk/src/debug.c
Log:
Fix NULL de-reference in debug code.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2010-01-11 12:44:33 UTC (rev 348)
+++ trunk/src/ChangeLog 2010-01-14 21:16:55 UTC (rev 349)
@@ -1,3 +1,10 @@
+2010-01-14 Werner Koch <wk at g10code.com>
+
+ * debug.c (_assuan_debug, _assuan_debug_begin)
+ (_assuan_debug_buffer): Check CTX before dereferencing.
+
+ * assuan.c (assuan_release): Immediately leave on NULL CTX.
+
2010-01-05 Marcus Brinkmann <marcus at g10code.de>
* debug.h (TRACE_LOG5): Add macro.
Modified: trunk/src/assuan.c
===================================================================
--- trunk/src/assuan.c 2010-01-11 12:44:33 UTC (rev 348)
+++ trunk/src/assuan.c 2010-01-14 21:16:55 UTC (rev 349)
@@ -176,11 +176,11 @@
void
assuan_release (assuan_context_t ctx)
{
- TRACE (ctx, ASSUAN_LOG_CTX, "assuan_release", ctx);
-
if (! ctx)
return;
+ TRACE (ctx, ASSUAN_LOG_CTX, "assuan_release", ctx);
+
_assuan_reset (ctx);
/* None of the members that are our responsibility requires
deallocation. */
Modified: trunk/src/debug.c
===================================================================
--- trunk/src/debug.c 2010-01-11 12:44:33 UTC (rev 348)
+++ trunk/src/debug.c 2010-01-14 21:16:55 UTC (rev 349)
@@ -49,7 +49,7 @@
char *msg;
int res;
- if (ctx->log_cb == NULL)
+ if (!ctx || !ctx->log_cb)
return;
saved_errno = errno;
@@ -75,8 +75,9 @@
*line = NULL;
/* Probe if this wants to be logged based on category. */
- if (! ctx->log_cb ||
- ! (*ctx->log_cb) (ctx, ctx->log_cb_data, cat, NULL))
+ if (! ctx
+ || ! ctx->log_cb
+ || ! (*ctx->log_cb) (ctx, ctx->log_cb_data, cat, NULL))
return;
va_start (arg_ptr, format);
@@ -144,8 +145,9 @@
int j;
/* Probe if this wants to be logged based on category. */
- if (! ctx->log_cb ||
- ! (*ctx->log_cb) (ctx, ctx->log_cb_data, cat, NULL))
+ if (!ctx
+ || ! ctx->log_cb
+ || ! (*ctx->log_cb) (ctx, ctx->log_cb_data, cat, NULL))
return;
while (idx < len)
More information about the Gnupg-commits
mailing list