diff options
author | Ard Biesheuvel <abies@php.net> | 2003-08-16 16:09:24 +0000 |
---|---|---|
committer | Ard Biesheuvel <abies@php.net> | 2003-08-16 16:09:24 +0000 |
commit | 254f827c4bbc025f77a70edbed30ee29ac58b10c (patch) | |
tree | d4c24bdb36c54a220ac14ad65f0f35fe74165c29 | |
parent | 6561a0546be2fa0a913f47bc9084241928ad3cfe (diff) | |
download | php-git-254f827c4bbc025f77a70edbed30ee29ac58b10c.tar.gz |
Fixed bug #18744
-rw-r--r-- | ext/interbase/interbase.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c index bf942d9dd6..a57d82bd86 100644 --- a/ext/interbase/interbase.c +++ b/ext/interbase/interbase.c @@ -3347,6 +3347,8 @@ PHP_FUNCTION(ibase_blob_add) { zval **blob_arg, **string_arg; ibase_blob_handle *ib_blob; + unsigned long put_cnt = 0, rem_cnt; + unsigned short chunk_size; RESET_ERRMSG; @@ -3360,9 +3362,15 @@ PHP_FUNCTION(ibase_blob_add) convert_to_string_ex(string_arg); - if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short) Z_STRLEN_PP(string_arg), Z_STRVAL_PP(string_arg))) { - _php_ibase_error(TSRMLS_C); - RETURN_FALSE; + for (rem_cnt = Z_STRLEN_PP(string_arg); rem_cnt > 0; rem_cnt -= chunk_size) { + + chunk_size = rem_cnt > USHRT_MAX ? USHRT_MAX : rem_cnt; + + if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, chunk_size, &Z_STRVAL_PP(string_arg)[put_cnt] )) { + _php_ibase_error(TSRMLS_C); + RETURN_FALSE; + } + put_cnt += chunk_size; } RETURN_TRUE; } |