aboutsummaryrefslogtreecommitdiff
path: root/libssh/keyfiles.c
diff options
context:
space:
mode:
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;