php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #79702
Patch ssh2_fix_nullpointer_deref.patch revision 2021-04-09 10:56 UTC by thomas at shadowweb dot org

Patch ssh2_fix_nullpointer_deref.patch for ssh2 Bug #79702

Patch version 2021-04-09 10:56 UTC

Return to Bug #79702 | Download this patch
Patch Revisions:

Developer: thomas@shadowweb.org

--- ssh2.c.org	2021-03-02 12:01:49.000000000 +0100
+++ ssh2.c	2021-04-09 11:52:03.964963109 +0200
@@ -653,7 +653,7 @@
 {
 	LIBSSH2_SESSION *session;
 	zval *zsession;
-	zend_string *username, *pubkey, *privkey, *passphrase;
+	zend_string *username, *pubkey, *privkey, *passphrase = NULL;
 #ifndef PHP_WIN32
 	zend_string *newpath;
 	struct passwd *pws;
@@ -689,7 +689,7 @@
 #endif
 
 	/* TODO: Support passphrase callback */
-	if (libssh2_userauth_publickey_fromfile_ex(session, ZSTR_VAL(username), ZSTR_LEN(username), ZSTR_VAL(pubkey), ZSTR_VAL(privkey), ZSTR_VAL(passphrase))) {
+	if (libssh2_userauth_publickey_fromfile_ex(session, ZSTR_VAL(username), ZSTR_LEN(username), ZSTR_VAL(pubkey), ZSTR_VAL(privkey), passphrase ? ZSTR_VAL(passphrase) : NULL)) {
 		char *buf;
 		int len;
 		libssh2_session_last_error(session, &buf, &len, 0);
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jun 15 20:01:23 2021 UTC