From 20e7ec96ae01d4367a7fbcd87bdbf0fa6496492b Mon Sep 17 00:00:00 2001 From: Aris Adamantiadis Date: Wed, 28 Apr 2010 18:43:41 +0200 Subject: Fix bugs found by clang analyzer --- libssh/keyfiles.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libssh/keyfiles.c') 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; -- cgit