From ba1ff992cea783f2d8512d34c114195fa28ecc8f Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 4 Sep 2018 20:51:30 +0200 Subject: [PATCH] libsshpp: Initialize the string returned by getIssueBanner() Fixes T13 Signed-off-by: Andreas Schneider --- include/libssh/libsshpp.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/libssh/libsshpp.hpp b/include/libssh/libsshpp.hpp index 62cc7163..ab431d89 100644 --- a/include/libssh/libsshpp.hpp +++ b/include/libssh/libsshpp.hpp @@ -335,11 +335,10 @@ public: * @see ssh_get_issue_banner */ std::string getIssueBanner(){ - char *banner=ssh_get_issue_banner(c_session); - std::string ret; - if (banner) - { - ret= std::string(banner); + char *banner = ssh_get_issue_banner(c_session); + std::string ret = ""; + if (banner != NULL) { + ret = std::string(banner); ::free(banner); } return ret;