php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch 0001-Fix-bug-70572-segfault-in-mysqlnd_connect.patch for MySQL related Bug #70572

Patch version 2015-09-24 12:12 UTC

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

Developer: remi@php.net

From d5159c86e6ec72e4bac43d7495b0645ade5bfcbd Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Thu, 24 Sep 2015 14:11:29 +0200
Subject: [PATCH] Fix bug #70572 segfault in mysqlnd_connect

---
 ext/mysqlnd/mysqlnd_net.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c
index fa0ea8f..091b9f5 100644
--- a/ext/mysqlnd/mysqlnd_net.c
+++ b/ext/mysqlnd/mysqlnd_net.c
@@ -207,10 +207,12 @@ MYSQLND_METHOD(mysqlnd_net, open_tcp_or_unix)(MYSQLND_NET * const net, const cha
 			mnd_sprintf_free(hashed_details);
 		}
 		errcode = CR_CONNECTION_ERROR;
-		SET_CLIENT_ERROR(*error_info, errcode? errcode:CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, errstr);
 		if (errstr) {
+			SET_CLIENT_ERROR(*error_info, errcode, UNKNOWN_SQLSTATE, errstr);
 			/* no mnd_ since we don't allocate it */
 			efree(errstr);
+		} else {
+			SET_CLIENT_ERROR(*error_info, errcode, UNKNOWN_SQLSTATE, "Unknown errror while connecting");
 		}
 		DBG_RETURN(NULL);
 	}
-- 
2.1.0

 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Apr 13 09:01:24 2021 UTC