diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-04-28 18:43:41 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-04-28 18:43:41 +0200 |
commit | 20e7ec96ae01d4367a7fbcd87bdbf0fa6496492b (patch) | |
tree | e2c7e9e7bda246d0b376ffeb3d19252b6f3f1c5e /libssh/keyfiles.c | |
parent | 2e563e0fa88aa174d3b945202fbe8f81a81bd4c3 (diff) | |
download | libssh-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.c | 7 |
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; |