diff options
author | Werner Koch <wk@gnupg.org> | 2016-06-25 15:38:06 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2016-06-25 15:38:49 +0200 |
commit | 5a5b055b81ee60a22a846bdf2031516b1c24df98 (patch) | |
tree | 39dff2932cf6d52325e87e1e278457ac4a6ba5a1 /src/misc.c | |
parent | 3f98b1e92d5afd720d7cea5b4e8295c5018bf9ac (diff) | |
download | libgcrypt-5a5b055b81ee60a22a846bdf2031516b1c24df98.tar.gz |
Improve robustness and help lint.
* cipher/rsa.c (rsa_encrypt): Check for !DATA.
* cipher/md.c (search_oid): Check early for !OID.
(md_copy): Use gpg_err_code_from_syserror. Replace chains of if(!err)
tests.
* cipher/cipher.c (search_oid): Check early for !OID.
* src/misc.c (do_printhex): Allow for BUFFER==NULL even with LENGTH>0.
* mpi/mpicoder.c (onecompl): Allow for A==NULL to help static
analyzers.
--
The change for md_copy is to help static analyzers which have no idea
that gpg_err_code_from_syserror will never return 0. A gcc attribute
returns_nonzero would be a nice to have.
Some changes are due to the fact the macros like mpi_is_immutable
gracefully handle a NULL arg but a static analyzer the considers that
the function allows for a NULL arg.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'src/misc.c')
-rw-r--r-- | src/misc.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -291,7 +291,7 @@ do_printhex (const char *text, const char *text2, log_debug ("%*s ", (int)strlen(text), ""); } } - if (length) + if (length && buffer) { const unsigned char *p = buffer; for (; length--; p++) |