diff options
| author | Andrey Hristov <andrey@php.net> | 2008-09-16 14:34:11 +0000 |
|---|---|---|
| committer | Andrey Hristov <andrey@php.net> | 2008-09-16 14:34:11 +0000 |
| commit | a7226f1a0394bee4d39873e63f2420cd2eb99d34 (patch) | |
| tree | 7035270c336a9e4623c4ef1990d3026ae0257fe8 /ext/mysqlnd/mysqlnd_wireprotocol.c | |
| parent | 07aac764a5aff0f54f8544c709f676d19bf3cf05 (diff) | |
| download | php-git-a7226f1a0394bee4d39873e63f2420cd2eb99d34.tar.gz | |
Fix a crash introduced yesterday in mysqlnd, non-zts mode - missing if () for
STAT_LAST was accessing wrong memory thus overwritting method pointers.
Windows doesn't have atoll(), which is C99, C89 has only atoi() + atol().
Win has _atoi64, so use it.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_wireprotocol.c')
| -rw-r--r-- | ext/mysqlnd/mysqlnd_wireprotocol.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index 0dc013df41..d5e09a1288 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -1560,10 +1560,20 @@ void php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, if (perm_bind.pack_len < SIZEOF_LONG) { /* direct conversion */ - int64 v = atoll((char *) p); + int64 v = +#ifndef PHP_WIN32 + atoll((char *) p); +#else + _atoi64((char *) p); +#endif ZVAL_LONG(*current_field, v); } else { - uint64 v = (uint64) atoll((char *) p); + uint64 v = +#ifndef PHP_WIN32 + (uint64) atoll((char *) p); +#else + (uint64) _atoi64((char *) p); +#endif zend_bool uns = fields_metadata[i].flags & UNSIGNED_FLAG? TRUE:FALSE; /* We have to make it ASCIIZ temporarily */ #if SIZEOF_LONG==8 @@ -1580,13 +1590,11 @@ void php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, } } *(p + len) = save; - } else if (as_int_or_float && perm_bind.php_type == IS_DOUBLE) - { + } else if (as_int_or_float && perm_bind.php_type == IS_DOUBLE) { zend_uchar save = *(p + len); /* We have to make it ASCIIZ temporarily */ *(p + len) = '\0'; - double v = atof((char *) p); - ZVAL_DOUBLE(*current_field, v); + ZVAL_DOUBLE(*current_field, atof((char *) p)); *(p + len) = save; } else #endif /* MYSQLND_STRING_TO_INT_CONVERSION */ |
