[svn] GnuPG - r4815 - branches/STABLE-BRANCH-1-4/util
svn author wk
cvs at cvs.gnupg.org
Tue Aug 19 21:36:05 CEST 2008
Author: wk
Date: 2008-08-19 21:36:04 +0200 (Tue, 19 Aug 2008)
New Revision: 4815
Modified:
branches/STABLE-BRANCH-1-4/util/ChangeLog
branches/STABLE-BRANCH-1-4/util/iobuf.c
Log:
Fix possible NULL argument to printf
Modified: branches/STABLE-BRANCH-1-4/util/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/util/ChangeLog 2008-08-18 11:08:04 UTC (rev 4814)
+++ branches/STABLE-BRANCH-1-4/util/ChangeLog 2008-08-19 19:36:04 UTC (rev 4815)
@@ -1,3 +1,9 @@
+2008-08-19 Werner Koch <wk at g10code.com>
+
+ * iobuf.c: Avoid passing a NULL (iobuf_t)->desc to the log
+ function. Should in general never be NULL, but well. Reported by
+ M. Heneka.
+
2008-03-06 David Shaw <dshaw at jabberwocky.com>
* argparse.c (default_strusage): Update copyright date.
Modified: branches/STABLE-BRANCH-1-4/util/iobuf.c
===================================================================
--- branches/STABLE-BRANCH-1-4/util/iobuf.c 2008-08-18 11:08:04 UTC (rev 4814)
+++ branches/STABLE-BRANCH-1-4/util/iobuf.c 2008-08-19 19:36:04 UTC (rev 4815)
@@ -1,6 +1,6 @@
/* iobuf.c - file handling
* Copyright (C) 1998, 1999, 2000, 2001, 2003,
- * 2004 Free Software Foundation, Inc.
+ * 2004, 2008 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -883,7 +883,7 @@
(byte*)&desc, &dummy_len );
log_debug("iobuf chain: %d.%d `%s' filter_eof=%d start=%d len=%d\n",
- a->no, a->subno, desc, a->filter_eof,
+ a->no, a->subno, desc?desc:"?", a->filter_eof,
(int)a->d.start, (int)a->d.len );
}
}
@@ -938,7 +938,8 @@
log_error("iobuf_flush failed on close: %s\n", g10_errstr(rc));
if( DBG_IOBUF )
- log_debug("iobuf-%d.%d: close `%s'\n", a->no, a->subno, a->desc );
+ log_debug("iobuf-%d.%d: close `%s'\n", a->no, a->subno,
+ a->desc?a->desc:"?");
if( a->filter && (rc = a->filter(a->filter_ov, IOBUFCTRL_FREE,
a->chain, NULL, &dummy_len)) )
log_error("IOBUFCTRL_FREE failed on close: %s\n", g10_errstr(rc) );
@@ -1199,7 +1200,8 @@
file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
if( DBG_IOBUF )
- log_debug("iobuf-%d.%d: create `%s'\n", a->no, a->subno, a->desc );
+ log_debug("iobuf-%d.%d: create `%s'\n", a->no, a->subno,
+ a->desc?a->desc:"?" );
return a;
}
@@ -1232,7 +1234,8 @@
file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
if( DBG_IOBUF )
- log_debug("iobuf-%d.%d: append `%s'\n", a->no, a->subno, a->desc );
+ log_debug("iobuf-%d.%d: append `%s'\n", a->no, a->subno,
+ a->desc?a->desc:"?" );
return a;
}
@@ -1260,7 +1263,8 @@
file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
if( DBG_IOBUF )
- log_debug("iobuf-%d.%d: openrw `%s'\n", a->no, a->subno, a->desc );
+ log_debug("iobuf-%d.%d: openrw `%s'\n", a->no, a->subno,
+ a->desc?a->desc:"?");
return a;
}
@@ -1272,7 +1276,8 @@
if ( cmd == 1 ) { /* keep system filepointer/descriptor open */
if( DBG_IOBUF )
log_debug("iobuf-%d.%d: ioctl `%s' keep=%d\n",
- a? a->no:-1, a?a->subno:-1, a?a->desc:"?", intval );
+ a? a->no:-1, a?a->subno:-1,
+ a&&a->desc?a->desc:"?", intval );
for( ; a; a = a->chain )
if( !a->chain && a->filter == file_filter ) {
file_filter_ctx_t *b = a->filter_ov;
@@ -1301,7 +1306,8 @@
else if ( cmd == 3 ) { /* disallow/allow caching */
if( DBG_IOBUF )
log_debug("iobuf-%d.%d: ioctl `%s' no_cache=%d\n",
- a? a->no:-1, a?a->subno:-1, a?a->desc:"?", intval );
+ a? a->no:-1, a?a->subno:-1,
+ a&&a->desc?a->desc:"?", intval );
for( ; a; a = a->chain )
if( !a->chain && a->filter == file_filter ) {
file_filter_ctx_t *b = a->filter_ov;
@@ -1393,7 +1399,8 @@
f( ov, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &dummy_len );
if( DBG_IOBUF ) {
- log_debug("iobuf-%d.%d: push `%s'\n", a->no, a->subno, a->desc );
+ log_debug("iobuf-%d.%d: push `%s'\n", a->no, a->subno,
+ a->desc?a->desc:"?" );
print_chain( a );
}
@@ -1419,7 +1426,8 @@
BUG();
if( DBG_IOBUF )
- log_debug("iobuf-%d.%d: pop `%s'\n", a->no, a->subno, a->desc );
+ log_debug("iobuf-%d.%d: pop `%s'\n", a->no, a->subno,
+ a->desc?a->desc:"?" );
if( !a->filter ) { /* this is simple */
b = a->chain;
assert(b);
@@ -1497,7 +1505,7 @@
IOBUF b = a->chain;
if( DBG_IOBUF )
log_debug("iobuf-%d.%d: pop `%s' in underflow\n",
- a->no, a->subno, a->desc );
+ a->no, a->subno, a->desc?a->desc:"?" );
xfree(a->d.buf);
xfree(a->real_fname);
memcpy(a, b, sizeof *a);
@@ -1562,8 +1570,8 @@
if( !len && a->chain ) {
IOBUF b = a->chain;
if( DBG_IOBUF )
- log_debug("iobuf-%d.%d: pop `%s' in underflow (!len)\n",
- a->no, a->subno, a->desc );
+ log_debug("iobuf-%d.%d: pop in underflow (!len)\n",
+ a->no, a->subno);
xfree(a->d.buf);
xfree(a->real_fname);
memcpy(a,b, sizeof *a);
More information about the Gnupg-commits
mailing list