aboutsummaryrefslogtreecommitdiffstats
path: root/src/debug.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2014-04-15 14:40:48 +0000
committerWerner Koch <[email protected]>2014-04-16 07:25:30 +0000
commit326a2918d645dd3d38dbc928e4452c66cb9757f1 (patch)
tree1e3a954d74f1aa98e7ad0276f558d93fa22ba51c /src/debug.h
parentUse the generic autogen.sh script. (diff)
downloadlibassuan-326a2918d645dd3d38dbc928e4452c66cb9757f1.tar.gz
libassuan-326a2918d645dd3d38dbc928e4452c66cb9757f1.zip
Fix NULL deref when tracing is enabled and malloc fails.
* src/debug.h (TRACE_ERR): Check CTX before a deref. * src/assuan-defs.h (_assuan_error): Turn into an inline function and check CTX before a deref. -- Found by Hans-Christoph Steiner with cppcheck.
Diffstat (limited to 'src/debug.h')
-rw-r--r--src/debug.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/debug.h b/src/debug.h
index bd586c3..40f5aaa 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -1,18 +1,18 @@
/* debug.h - interface to debugging functions
Copyright (C) 2002, 2004, 2005, 2007 g10 Code GmbH
-
+
This file is part of Assuan.
Assuan is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
Assuan is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -170,7 +170,7 @@ void _assuan_debug_buffer (assuan_context_t ctx, unsigned int cat,
"%s (%s=%p): error: %s <%s>\n", \
_assuan_trace_func, _assuan_trace_tagname, \
_assuan_trace_tag, gpg_strerror (err), \
- gpg_strsource (ctx->err_source)), \
+ ctx?gpg_strsource (ctx->err_source):""), \
_assuan_error (ctx, err))
/* The cast to void suppresses GCC warnings. */