diff options
author | Marcus Brinkmann <[email protected]> | 2011-05-26 14:01:26 +0000 |
---|---|---|
committer | Marcus Brinkmann <[email protected]> | 2011-05-26 14:01:26 +0000 |
commit | b34add3fe438a693e236a835135bd11b4e177daa (patch) | |
tree | 8b66e12d5c62112f33d244340b96638ac30454d8 /src/encrypt.c | |
parent | Fix I/O callback example. (diff) | |
download | gpgme-b34add3fe438a693e236a835135bd11b4e177daa.tar.gz gpgme-b34add3fe438a693e236a835135bd11b4e177daa.zip |
Check context pointers for null pointer on entry points.
Diffstat (limited to 'src/encrypt.c')
-rw-r--r-- | src/encrypt.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/encrypt.c b/src/encrypt.c index c9599b5c..641e9004 100644 --- a/src/encrypt.c +++ b/src/encrypt.c @@ -231,6 +231,9 @@ gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_key_t recp[], TRACE_BEG3 (DEBUG_CTX, "gpgme_op_encrypt_start", ctx, "flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher); + + if (!ctx) + return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); if (_gpgme_debug_trace () && recp) { @@ -261,7 +264,10 @@ gpgme_op_encrypt (gpgme_ctx_t ctx, gpgme_key_t recp[], TRACE_BEG3 (DEBUG_CTX, "gpgme_op_encrypt", ctx, "flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher); - + + if (!ctx) + return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); + if (_gpgme_debug_trace () && recp) { int i = 0; |