mirror of
git://git.gnupg.org/gnupg.git
synced 2024-06-01 22:28:02 +02:00
Avoid passing NULL to printf while debugging.
This commit is contained in:
parent
8e89644451
commit
39a5a34eab
|
@ -1,3 +1,9 @@
|
||||||
|
2008-08-19 Werner Koch <wk@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-06-26 Werner Koch <wk@g10code.com>
|
2008-06-26 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* estream.c (es_write_sanitized): Loose check for control
|
* estream.c (es_write_sanitized): Loose check for control
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* iobuf.c - File Handling for OpenPGP.
|
/* iobuf.c - File Handling for OpenPGP.
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2006,
|
* Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2006,
|
||||||
* 2007 Free Software Foundation, Inc.
|
* 2007, 2008 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
we are using the low-evel backend.
|
we are using the low-evel backend.
|
||||||
|
|
||||||
fp_or_fd_t
|
fp_or_fd_t
|
||||||
Is the type we use for the backend stream or fiel descriptor.
|
Is the type we use for the backend stream or file descriptor.
|
||||||
|
|
||||||
INVALID_FP, FILEP_OR_FD_FOR_STDIN, FILEP_OR_FD_FOR_STDOUT
|
INVALID_FP, FILEP_OR_FD_FOR_STDIN, FILEP_OR_FD_FOR_STDOUT
|
||||||
Are macros defined depending on the used backend.
|
Are macros defined depending on the used backend.
|
||||||
|
@ -1012,7 +1012,7 @@ print_chain (iobuf_t a)
|
||||||
(byte *) & desc, &dummy_len);
|
(byte *) & desc, &dummy_len);
|
||||||
|
|
||||||
log_debug ("iobuf chain: %d.%d `%s' filter_eof=%d start=%d len=%d\n",
|
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);
|
(int) a->d.start, (int) a->d.len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1069,7 +1069,8 @@ iobuf_close (iobuf_t a)
|
||||||
log_error ("iobuf_flush failed on close: %s\n", gpg_strerror (rc));
|
log_error ("iobuf_flush failed on close: %s\n", gpg_strerror (rc));
|
||||||
|
|
||||||
if (DBG_IOBUF)
|
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,
|
if (a->filter && (rc = a->filter (a->filter_ov, IOBUFCTRL_FREE,
|
||||||
a->chain, NULL, &dummy_len)))
|
a->chain, NULL, &dummy_len)))
|
||||||
log_error ("IOBUFCTRL_FREE failed on close: %s\n", gpg_strerror (rc));
|
log_error ("IOBUFCTRL_FREE failed on close: %s\n", gpg_strerror (rc));
|
||||||
|
@ -1336,7 +1337,8 @@ iobuf_create (const char *fname)
|
||||||
file_filter (fcx, IOBUFCTRL_DESC, NULL, (byte *) & a->desc, &len);
|
file_filter (fcx, IOBUFCTRL_DESC, NULL, (byte *) & a->desc, &len);
|
||||||
file_filter (fcx, IOBUFCTRL_INIT, NULL, NULL, &len);
|
file_filter (fcx, IOBUFCTRL_INIT, NULL, NULL, &len);
|
||||||
if (DBG_IOBUF)
|
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;
|
return a;
|
||||||
}
|
}
|
||||||
|
@ -1369,7 +1371,8 @@ iobuf_append (const char *fname)
|
||||||
file_filter (fcx, IOBUFCTRL_DESC, NULL, (byte *) & a->desc, &len);
|
file_filter (fcx, IOBUFCTRL_DESC, NULL, (byte *) & a->desc, &len);
|
||||||
file_filter (fcx, IOBUFCTRL_INIT, NULL, NULL, &len);
|
file_filter (fcx, IOBUFCTRL_INIT, NULL, NULL, &len);
|
||||||
if (DBG_IOBUF)
|
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;
|
return a;
|
||||||
}
|
}
|
||||||
|
@ -1397,7 +1400,8 @@ iobuf_openrw (const char *fname)
|
||||||
file_filter (fcx, IOBUFCTRL_DESC, NULL, (byte *) & a->desc, &len);
|
file_filter (fcx, IOBUFCTRL_DESC, NULL, (byte *) & a->desc, &len);
|
||||||
file_filter (fcx, IOBUFCTRL_INIT, NULL, NULL, &len);
|
file_filter (fcx, IOBUFCTRL_INIT, NULL, NULL, &len);
|
||||||
if (DBG_IOBUF)
|
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;
|
return a;
|
||||||
}
|
}
|
||||||
|
@ -1410,7 +1414,8 @@ iobuf_ioctl (iobuf_t a, int cmd, int intval, void *ptrval)
|
||||||
{ /* keep system filepointer/descriptor open */
|
{ /* keep system filepointer/descriptor open */
|
||||||
if (DBG_IOBUF)
|
if (DBG_IOBUF)
|
||||||
log_debug ("iobuf-%d.%d: ioctl `%s' keep=%d\n",
|
log_debug ("iobuf-%d.%d: ioctl `%s' keep=%d\n",
|
||||||
a ? a->no : -1, a ? a->subno : -1, a ? a->desc : "?",
|
a ? a->no : -1, a ? a->subno : -1,
|
||||||
|
a && a->desc ? a->desc : "?",
|
||||||
intval);
|
intval);
|
||||||
for (; a; a = a->chain)
|
for (; a; a = a->chain)
|
||||||
if (!a->chain && a->filter == file_filter)
|
if (!a->chain && a->filter == file_filter)
|
||||||
|
@ -1445,7 +1450,8 @@ iobuf_ioctl (iobuf_t a, int cmd, int intval, void *ptrval)
|
||||||
{ /* disallow/allow caching */
|
{ /* disallow/allow caching */
|
||||||
if (DBG_IOBUF)
|
if (DBG_IOBUF)
|
||||||
log_debug ("iobuf-%d.%d: ioctl `%s' no_cache=%d\n",
|
log_debug ("iobuf-%d.%d: ioctl `%s' no_cache=%d\n",
|
||||||
a ? a->no : -1, a ? a->subno : -1, a ? a->desc : "?",
|
a ? a->no : -1, a ? a->subno : -1,
|
||||||
|
a && a->desc? a->desc : "?",
|
||||||
intval);
|
intval);
|
||||||
for (; a; a = a->chain)
|
for (; a; a = a->chain)
|
||||||
if (!a->chain && a->filter == file_filter)
|
if (!a->chain && a->filter == file_filter)
|
||||||
|
@ -1546,7 +1552,8 @@ iobuf_push_filter2 (iobuf_t a,
|
||||||
|
|
||||||
if (DBG_IOBUF)
|
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);
|
print_chain (a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1573,7 +1580,8 @@ pop_filter (iobuf_t a, int (*f) (void *opaque, int control,
|
||||||
BUG ();
|
BUG ();
|
||||||
|
|
||||||
if (DBG_IOBUF)
|
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)
|
if (!a->filter)
|
||||||
{ /* this is simple */
|
{ /* this is simple */
|
||||||
b = a->chain;
|
b = a->chain;
|
||||||
|
@ -1660,7 +1668,7 @@ underflow (iobuf_t a)
|
||||||
iobuf_t b = a->chain;
|
iobuf_t b = a->chain;
|
||||||
if (DBG_IOBUF)
|
if (DBG_IOBUF)
|
||||||
log_debug ("iobuf-%d.%d: pop `%s' in underflow\n",
|
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->d.buf);
|
||||||
xfree (a->real_fname);
|
xfree (a->real_fname);
|
||||||
memcpy (a, b, sizeof *a);
|
memcpy (a, b, sizeof *a);
|
||||||
|
@ -1733,8 +1741,8 @@ underflow (iobuf_t a)
|
||||||
{
|
{
|
||||||
iobuf_t b = a->chain;
|
iobuf_t b = a->chain;
|
||||||
if (DBG_IOBUF)
|
if (DBG_IOBUF)
|
||||||
log_debug ("iobuf-%d.%d: pop `%s' in underflow (!len)\n",
|
log_debug ("iobuf-%d.%d: pop in underflow (!len)\n",
|
||||||
a->no, a->subno, a->desc);
|
a->no, a->subno);
|
||||||
xfree (a->d.buf);
|
xfree (a->d.buf);
|
||||||
xfree (a->real_fname);
|
xfree (a->real_fname);
|
||||||
memcpy (a, b, sizeof *a);
|
memcpy (a, b, sizeof *a);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user