[Pkg-gnupg-commit] [gpgme] 262/412: Cpp: Fix simple symmetric encryption

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 22 21:26:59 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gpgme.

commit bf776ce94cf454f1b3f1645b1cde09cd1c54324b
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Aug 9 12:56:01 2016 +0200

    Cpp: Fix simple symmetric encryption
    
    * lang/cpp/src/context.cpp (Context::encrypt): If no recipients
    are provided encrypt with NULL and not an empty array.
    
    --
    Sending an empty array leads to an invalid argument error.
---
 lang/cpp/src/context.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index 20d827e..814e5a8 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -1113,7 +1113,8 @@ EncryptionResult Context::encrypt(const std::vector<Key> &recipients, const Data
         }
     }
     *keys_it++ = 0;
-    d->lasterr = gpgme_op_encrypt(d->ctx, keys, encryptflags2encryptflags(flags),
+    d->lasterr = gpgme_op_encrypt(d->ctx, recipients.empty() ? nullptr : keys,
+                                  encryptflags2encryptflags(flags),
                                   pdp ? pdp->data : 0, cdp ? cdp->data : 0);
     delete[] keys;
     return EncryptionResult(d->ctx, Error(d->lasterr));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list