Skip to content

Commit 2a70a41

Browse files
committed
changed to use php_memnistr
1 parent a66bfab commit 2a70a41

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

ext/odbc/php_odbc.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,21 +2096,8 @@ int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int
20962096
if (strstr((char*)db, "=")) {
20972097
direct = 1;
20982098

2099-
/* There are many character comparison patterns, so convert them to lower case. */
2100-
size_t db_len = strlen(db);
2101-
char *lower_db = (char*) emalloc(db_len);
2102-
strcpy(lower_db, db);
2103-
2104-
unsigned char *c = (unsigned char *) lower_db;
2105-
const unsigned char *e = c + db_len;
2106-
while (c < e) {
2107-
*c = tolower(*c);
2108-
c++;
2109-
}
2110-
2111-
bool use_uid_arg = !strstr(lower_db, "uid=");
2112-
bool use_pwd_arg = !strstr(lower_db, "pwd=");
2113-
efree(lower_db);
2099+
bool use_uid_arg = !php_memnistr(db, "uid=", strlen("uid="), db + strlen(db));
2100+
bool use_pwd_arg = !php_memnistr(db, "pwd=", strlen("pwd="), db + strlen(db));
21142101

21152102
/* Force UID and PWD to be set in the DSN */
21162103
if (use_uid_arg || use_pwd_arg) {

0 commit comments

Comments
 (0)