summaryrefslogtreecommitdiff
path: root/cipher
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2014-04-15 16:40:48 +0200
committerWerner Koch <wk@gnupg.org>2014-04-15 22:15:11 +0200
commitae1fbce6dacf14747af0126e640bd4e54cb8c680 (patch)
tree6a9db333470556e45b920cd02ce2e7da745089aa /cipher
parentb76b632a453b8d100d024e2439b4358454dc286e (diff)
downloadlibgcrypt-ae1fbce6dacf14747af0126e640bd4e54cb8c680.tar.gz
cipher: Fix possible NULL dereference.
* cipher/md.c (_gcry_md_selftest): Check for spec being NULL. -- Also removed left-over code in unused file cipher/test-getrusage.c. Found by Hans-Christoph Steiner with cppcheck.
Diffstat (limited to 'cipher')
-rw-r--r--cipher/md.c3
-rw-r--r--cipher/test-getrusage.c4
2 files changed, 2 insertions, 5 deletions
diff --git a/cipher/md.c b/cipher/md.c
index 461ad642..5ab89cbd 100644
--- a/cipher/md.c
+++ b/cipher/md.c
@@ -1250,7 +1250,8 @@ _gcry_md_selftest (int algo, int extended, selftest_report_func_t report)
ec = spec->selftest (algo, extended, report);
else
{
- ec = spec->selftest? GPG_ERR_DIGEST_ALGO : GPG_ERR_NOT_IMPLEMENTED;
+ ec = (spec && spec->selftest) ? GPG_ERR_DIGEST_ALGO
+ /* */ : GPG_ERR_NOT_IMPLEMENTED;
if (report)
report ("digest", algo, "module",
(spec && !spec->flags.disabled)?
diff --git a/cipher/test-getrusage.c b/cipher/test-getrusage.c
index 6fc8372d..7f586dd8 100644
--- a/cipher/test-getrusage.c
+++ b/cipher/test-getrusage.c
@@ -45,10 +45,6 @@ main (int argc, char **argv)
printf ("ru_nvcsw = %ld\n", buf.ru_nvcsw );
printf ("ru_nivcsw = %ld\n", buf.ru_nivcsw );
- fprintf (stderr, "ru_utime ru_stime ru_minflt ru_nccsw ru_nivcsw\n");
- fprintf (stderr, "%ld.%06ld %ld.%06ld %5ld %5ld %5ld\n");
-
-
return 0;
}