[Pkg-gnupg-commit] [gpgme] 42/53: cpp: Fix init of string from null
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Mon Oct 24 19:26:52 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gpgme.
commit 1e8c34a9192956bb2fe96a7a6a76ff59de8d1c0c
Author: Andre Heinecke <aheinecke at intevation.de>
Date: Fri Oct 14 16:23:57 2016 +0200
cpp: Fix init of string from null
* lang/cpp/src/key.cpp (UserID::addrSpecFromString): Check return
value before creating the string.
---
lang/cpp/src/key.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index 947405f..235a3c8 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -884,9 +884,12 @@ std::string UserID::addrSpecFromString(const char *userid)
return std::string();
}
char *normalized = gpgme_addrspec_from_uid (userid);
- std::string ret(normalized);
- gpgme_free(normalized);
- return ret;
+ if (normalized) {
+ std::string ret(normalized);
+ gpgme_free(normalized);
+ return ret;
+ }
+ return std::string();
}
std::string UserID::addrSpec() const
--
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