Author: ahristov
Date: 2007-03-15 08:52:37 +0100 (Thu, 15 Mar 2007)
New Revision: 146
Modified:
trunk/ext/mysqli/mysqlnd/mysqlnd.c
Log:
Add more checks or we will crash sooner or later.
Modified: trunk/ext/mysqli/mysqlnd/mysqlnd.c
===================================================================
--- trunk/ext/mysqli/mysqlnd/mysqlnd.c 2007-03-14 19:11:02 UTC (rev 145)
+++ trunk/ext/mysqli/mysqlnd/mysqlnd.c 2007-03-15 07:52:37 UTC (rev 146)
@@ -596,13 +596,24 @@
return NULL;
}
- if (!host || !*host) {
+ if (!host || !host[0]) {
host = "localhost";
}
-
+ if (!user) {
+ user = "";
+ }
+ if (!passwd) {
+ passwd = "";
+ passwd_len = 0;
+ }
+ if (!db) {
+ db = "";
+ db_len = 0;
+ }
if (!port && !socket) {
port = 3306;
}
+
if (!strncasecmp(host, "localhost", sizeof("localhost") - 1)) {
if (!socket) {
socket = "/tmp/mysql.sock";
@@ -681,8 +692,8 @@
/* we allow load data local infile by default */
mysql_flags |= CLIENT_LOCAL_FILES;
- auth_packet->user = user? user:"";
- auth_packet->password = passwd? passwd:"";
+ auth_packet->user = user;
+ auth_packet->password = passwd;
auth_packet->charset_no = greet_packet.charset_no;
auth_packet->db = db;
auth_packet->db_len = db_len;
| Thread |
|---|
| • PHP mysqlnd svn commit: r146 - trunk/ext/mysqli/mysqlnd | ahristov | 15 Mar |