aboutsummaryrefslogtreecommitdiff
path: root/libssh/keyfiles.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-04-28 18:43:41 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2010-04-28 18:43:41 +0200
commit20e7ec96ae01d4367a7fbcd87bdbf0fa6496492b (patch)
treee2c7e9e7bda246d0b376ffeb3d19252b6f3f1c5e /libssh/keyfiles.c
parent2e563e0fa88aa174d3b945202fbe8f81a81bd4c3 (diff)
downloadlibssh-20e7ec96ae01d4367a7fbcd87bdbf0fa6496492b.tar.gz
libssh-20e7ec96ae01d4367a7fbcd87bdbf0fa6496492b.tar.xz
libssh-20e7ec96ae01d4367a7fbcd87bdbf0fa6496492b.zip
Fix bugs found by clang analyzer
Diffstat (limited to 'libssh/keyfiles.c')
-rw-r--r--libssh/keyfiles.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c
index 8c50776c..a5aae8cb 100644
--- a/libssh/keyfiles.c
+++ b/libssh/keyfiles.c
@@ -593,12 +593,13 @@ static int pem_get_password(char *buf, int size, int rwflag, void *userdata) {
/* unused flag */
(void) rwflag;
-
- ZERO_STRUCTP(buf);
+ if(buf==NULL)
+ return 0;
+ memset(buf,'\0',size);
ssh_log(session, SSH_LOG_RARE,
"Trying to call external authentication function");
- if (session && session->callbacks->auth_function) {
+ if (session && session->callbacks && session->callbacks->auth_function) {
if (session->callbacks->auth_function("Passphrase for private key:", buf, size, 0, 0,
session->callbacks->userdata) < 0) {
return 0;