summaryrefslogtreecommitdiff
path: root/ext/mysql/php_mysql.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-03-26 02:01:11 +0000
committerZeev Suraski <zeev@php.net>2000-03-26 02:01:11 +0000
commita0f70aa618ae046507ef6a861363d45dc099f1f5 (patch)
tree1a7fa15520a84e5b54a4593551ef3c553bfb363a /ext/mysql/php_mysql.c
parent04daa555aa857965de9b53e98d6eda34c1e0db46 (diff)
downloadphp-git-a0f70aa618ae046507ef6a861363d45dc099f1f5.tar.gz
@- Fix a data corruption bug in mysql_result(), if used in table.fieldname mode (Zeev)
Hopefully that settles this one.
Diffstat (limited to 'ext/mysql/php_mysql.c')
-rw-r--r--ext/mysql/php_mysql.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index ffcc722f9b..a6844a7c3c 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -400,7 +400,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
tmp++;
if (tmp[0] != '/') {
port = atoi(tmp);
- if(tmp=strchr(tmp,':')) {
+ if ((tmp=strchr(tmp, ':'))) {
*tmp=0;
tmp++;
socket=tmp;
@@ -1163,8 +1163,7 @@ PHP_FUNCTION(mysql_result)
char *table_name, *field_name, *tmp;
if ((tmp=strchr((*field)->value.str.val,'.'))) {
- *tmp = 0;
- table_name = estrdup((*field)->value.str.val);
+ table_name = estrndup((*field)->value.str.val, tmp-(*field)->value.str.val);
field_name = estrdup(tmp+1);
} else {
table_name = NULL;