Home GnuPG

Improve robustness and help lint.
5a5b055b81eeUnpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

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>

Details

Provenance
wernerAuthored on Jun 25 2016, 3:38 PM
Parents
rC3f98b1e92d5a: cipher: Improve fatal error message for bad use of gcry_md_read.
Branches
Unknown
Tags
Unknown

Event Timeline

Werner Koch <wk@gnupg.org> committed rC5a5b055b81ee: Improve robustness and help lint. (authored by Werner Koch <wk@gnupg.org>).Jun 25 2016, 3:38 PM