Compare commits

..
41 Commits
Author SHA1 Message Date
Joe Watkins 481520d381 set versions for release 2019-08-28 09:06:38 +02:00
Christoph M. Becker 7bf1f9d561 Fix #75457: heap-use-after-free in php7.0.25
Backport <https://vcs.pcre.org/pcre?view=revision&revision=1638>.
2019-08-25 19:19:50 -07:00
Stanislav Malyshev 1258303e66 Fix CVE-2019-13224: don't allow different encodings for onig_new_deluxe()
Backport from https://github.com/kkos/oniguruma/commit/0f7f61ed1b7b697e283e37bd2d731d0bd57adb55
2019-08-24 23:11:45 -07:00
Joe Watkins 1c01a1579e set version for release 2019-07-31 08:21:39 +02:00
Christoph M. Becker cd1101e8c8 Fix #77919: Potential UAF in Phar RSHUTDOWN
We have to properly clean up in case phar_flush() is failing.

We also make the expectation of the respective test case less liberal
to avoid missing such bugs in the future.
2019-07-29 13:18:27 -07:00
Stanislav Malyshev 42e8b85d94 Update NEWS 2019-07-29 13:16:53 -07:00
Stanislav Malyshev aeb6d13185 Fix bug #78256 (heap-buffer-overflow on exif_process_user_comment) 2019-07-29 00:53:37 -07:00
Stanislav Malyshev dea2989ab8 Fix bug #78222 (heap-buffer-overflow on exif_scan_thumbnail) 2019-07-29 00:53:28 -07:00
Christoph M. Becker e944ae6b2a Upgrade to SQLite 3.28.0
Over the years, multiple security vulnerabilities[1] have been found
and fixed in SQLite3, so it makes sense to update our bundled libsqlite
to the latest available version.

[1] <https://www.cvedetails.com/vulnerability-list/vendor_id-9237/Sqlite.html>
2019-07-09 09:59:46 +02:00
Joe Watkins 5533f2490a bump version after release 2019-05-28 09:52:52 +02:00
Stanislav Malyshev c34895e837 Fix bug #77967 - Bypassing open_basedir restrictions via file uris 2019-05-27 18:48:48 -07:00
Stanislav Malyshev 73ff4193be Fix bug #77988 - heap-buffer-overflow on php_jpg_get16 2019-05-27 17:28:09 -07:00
Stanislav Malyshev 16e037bd46 Update NEWS 2019-05-27 16:48:32 -07:00
Stanislav Malyshev 7cf7148a8f Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow 2019-05-27 16:32:42 -07:00
Christoph M. Becker ed6dee9a19 Fix #77973: Uninitialized read in gdImageCreateFromXbm
We have to ensure that `sscanf()` does indeed read a hex value here,
and bail out otherwise.
2019-05-27 16:11:32 -07:00
Stanislav Malyshev f80ad18afa Fix bug #77950 - Heap-buffer-overflow in _estrndup via exif_process_IFD_TAG
I do not completely understand what is going on there, but I am pretty
sure dir_entry <= offset_base if not a normal situation, so we better not
to rely on such dir_entry.
2019-04-30 00:05:23 -07:00
Christoph M. Becker 6c631ccfef Fix #77821: Potential heap corruption in TSendMail()
`zend_string_tolower()` returns a copy (not a duplicate) of the given
string, if it is already in lower case.  In this case we must not not
`zend_string_free()` both strings.  The cleanest solution is to call
` zend_string_release()` on both strings, which properly handles the
refcount.
2019-04-29 22:08:19 -07:00
Stanislav Malyshev 588db7cecf Always use ZEND_SECURE_ZERO() when cleaning up data
Optimizing compilers have an annoying tendency to throw out
memsets over data that they think aren't used anymore. Apply secure
zero-out in cases where this has potential to happen.
2019-04-06 18:15:42 -07:00
Joe Watkins 731eeb8dec bump versions after release 2019-04-02 16:50:20 +02:00
Remi Collet dc1cd3daf2 fix paste issue 2019-04-02 11:05:09 +02:00
Christoph M. Becker 01a4de5c58 Pointer arithmetic on void pointers is illegal
We quick-fix this by casting to char*; it might be more appropriate to
use char pointers in the first place.
2019-04-02 10:39:44 +02:00
Stanislav Malyshev 887a7b5714 Fixed bug #77831 - Heap-buffer-overflow in exif_iif_add_value in EXIF 2019-04-02 00:12:26 -07:00
Stanislav Malyshev c684d32fb8 Update NEWS 2019-03-31 23:11:15 -07:00
Stanislav Malyshev f3aefc6d07 Fix bug #77753 - Heap-buffer-overflow in php_ifd_get32s 2019-03-31 23:09:06 -07:00
Nikita Popov 0ecac37c40 Validate subject encoding in mb_split and mb_ereg_match
We were already validating the subject encoding in most functions,
but not these two.
2019-03-27 23:20:27 -07:00
Nikita Popov 40fe50daf6 Validate pattern against mbregex encoding
Oniguruma does not consistently perform this validation itself (at least
on older versions), so make sure we check pattern encoding validity on the
PHP side.
2019-03-27 23:19:46 -07:00
bohwaz 58c25bf679 SQLite3: add DEFENSIVE config for SQLite >= 3.26.0 as a mitigation strategy against potential security flaws 2019-03-11 18:02:03 +01:00
Anatol Belski 66bd861fcd Sync with behavior change in OpenSSL 1.1.1b
A behavior change in revealed by some openssl_decrypt() based test,
where an encrypt API is used with a decrypt context. The EVP_Cipher*
functions will automatically choose the right operation depending on the
context passed.

(cherry picked from commit 19a44ffb7b)
2019-03-08 15:47:32 +01:00
Joe Watkins b6308f5b48 fix news 2019-03-05 20:50:07 +01:00
Joe Watkins 58c5df3d37 bump versions after release 2019-03-05 18:28:47 +01:00
Stanislav Malyshev e3133e4db7 Fix bug #77630 - safer rename() procedure
In order to rename safer, we do the following:
- set umask to 077 (unfortunately, not TS, so excluding ZTS)
- chown() first, to set proper group before allowing group access
- chmod() after, even if chown() fails
2019-03-04 09:15:11 -08:00
Stanislav Malyshev e0f5d62bd6 Fix bug #77586 - phar_tar_writeheaders_int() buffer overflow 2019-03-03 23:05:32 -08:00
Stanislav Malyshev 759e841b24 Update NEWS 2019-03-03 20:10:12 -08:00
Stanislav Malyshev 44f87fbf36 Fix test error message 2019-03-03 19:30:14 -08:00
Stanislav Malyshev 8ac6fee856 Fix bug #77563 - Uninitialized read in exif_process_IFD_in_MAKERNOTE
Also fix for bug #77659
2019-03-03 18:35:43 -08:00
Stanislav Malyshev 5f0e62a3e5 Fix bug #77540 - Invalid Read on exif_process_SOFn 2019-03-03 18:35:26 -08:00
Stanislav Malyshev 5e824a88d0 Fix integer overflows on 32-bits 2019-03-03 18:35:04 -08:00
Christoph M. Becker 254a5914ad Fix #77431 SplFileInfo::__construct() accepts NUL bytes
`SplFileInfo::__construct()` has to expect a path instead of a string,
analogous to `SplFileObject::__construct()`.
2019-03-03 18:23:46 -08:00
Stanislav Malyshev 7f0ab7c20c Fix bug #77396 - Null Pointer Dereference in phar_create_or_parse_filename 2019-03-03 18:22:32 -08:00
Derick Rethans 65d81833bb Use pkg-config for ICU, as the old icu-config has been deprecated 2019-02-07 14:00:39 +01:00
Sara Golemon fabade1573 Bump for 7.1.27 2019-01-08 14:17:43 -05:00
63 changed files with 43656 additions and 18313 deletions

No files matched your search

+79
View File
@@ -1,5 +1,84 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
29 Aug 2019, PHP 7.1.32
- mbstring:
. Fixed CVE-2019-13224 (don't allow different encodings for onig_new_deluxe) (stas)
- pcre:
. Fixed bug #75457 (heap use-after-free in pcrelib) (cmb)
01 Aug 2019, PHP 7.1.31
- SQLite:
. Upgraded to SQLite 3.28.0. (cmb)
- EXIF:
. Fixed bug #78256 (heap-buffer-overflow on exif_process_user_comment).
(CVE-2019-11042) (Stas)
. Fixed bug #78222 (heap-buffer-overflow on exif_scan_thumbnail).
(CVE-2019-11041) (Stas)
- Phar:
. Fixed bug #77919 (Potential UAF in Phar RSHUTDOWN). (cmb)
30 May 2019, PHP 7.1.30
- EXIF:
. Fixed bug #77988 (heap-buffer-overflow on php_jpg_get16).
(CVE-2019-11040) (Stas)
- GD:
. Fixed bug #77973 (Uninitialized read in gdImageCreateFromXbm).
(CVE-2019-11038) (cmb)
- Iconv:
. Fixed bug #78069 (Out-of-bounds read in iconv.c:_php_iconv_mime_decode()
due to integer overflow). (CVE-2019-11039). (maris dot adam)
- SQLite:
. Fixed bug #77967 (Bypassing open_basedir restrictions via file uris). (Stas)
03 May 2019, PHP 7.1.29
- EXIF:
. Fixed bug #77950 (Heap-buffer-overflow in _estrndup via exif_process_IFD_TAG).
(CVE-2019-11036) (Stas)
- Mail:
. Fixed bug #77821 (Potential heap corruption in TSendMail()). (cmb)
04 Apr 2019, PHP 7.1.28
- EXIF:
. Fixed bug #77753 (Heap-buffer-overflow in php_ifd_get32s). (CVE-2019-11034)
(Stas)
. Fixed bug #77831 (Heap-buffer-overflow in exif_iif_add_value).
(CVE-2019-11035) (Stas)
- SQLite3:
. Added sqlite3.defensive INI directive. (BohwaZ)
07 Mar 2019, PHP 7.1.27
- Core:
. Fixed bug #77630 (rename() across the device may allow unwanted access during
processing). (Stas)
- EXIF:
. Fixed bug #77509 (Uninitialized read in exif_process_IFD_in_TIFF). (Stas)
. Fixed bug #77540 (Invalid Read on exif_process_SOFn). (Stas)
. Fixed bug #77563 (Uninitialized read in exif_process_IFD_in_MAKERNOTE). (Stas)
. Fixed bug #77659 (Uninitialized read in exif_process_IFD_in_MAKERNOTE). (Stas)
- PHAR:
. Fixed bug #77396 (Null Pointer Dereference in phar_create_or_parse_filename).
(bishop)
. Fixed bug #77586 (phar_tar_writeheaders_int() buffer overflow). (bishop)
- SPL:
. Fixed bug #77431 (openFile() silently truncates after a null byte). (cmb)
10 Jan 2019, PHP 7.1.26
- Core:
+65 -31
View File
@@ -2212,45 +2212,79 @@ AC_DEFUN([PHP_SETUP_ICU],[
PHP_ICU_DIR=DEFAULT
fi
if test "$PHP_ICU_DIR" = "DEFAULT"; then
dnl Try to find icu-config
AC_PATH_PROG(ICU_CONFIG, icu-config, no, [$PATH:/usr/local/bin])
else
ICU_CONFIG="$PHP_ICU_DIR/bin/icu-config"
AC_MSG_CHECKING([for location of ICU headers and libraries])
found_icu=no
dnl First try to find pkg-config
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
AC_MSG_CHECKING([for location of ICU headers and libraries])
dnl If pkg-config is found try using it
if test "$PHP_ICU_DIR" = "DEFAULT" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists icu-uc icu-io icu-i18n; then
if $PKG_CONFIG --atleast-version=40 icu-uc; then
found_icu=yes
icu_version_full=`$PKG_CONFIG --modversion icu-uc`
ac_IFS=$IFS
IFS="."
set $icu_version_full
IFS=$ac_IFS
icu_version=`expr [$]1 \* 1000 + [$]2`
AC_MSG_RESULT([found $icu_version_full])
dnl Trust icu-config to know better what the install prefix is..
icu_install_prefix=`$ICU_CONFIG --prefix 2> /dev/null`
if test "$?" != "0" || test -z "$icu_install_prefix"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Unable to detect ICU prefix or $ICU_CONFIG failed. Please verify ICU install prefix and make sure icu-config works.])
else
AC_MSG_RESULT([$icu_install_prefix])
ICU_LIBS=`$PKG_CONFIG --libs icu-uc icu-io icu-i18n`
ICU_INCS=`$PKG_CONFIG --cflags-only-I icu-uc icu-io icu-i18n`
ICU_CXXFLAGS="-DU_USING_ICU_NAMESPACE=1"
dnl Check ICU version
AC_MSG_CHECKING([for ICU 4.0 or greater])
icu_version_full=`$ICU_CONFIG --version`
ac_IFS=$IFS
IFS="."
set $icu_version_full
IFS=$ac_IFS
icu_version=`expr [$]1 \* 1000 + [$]2`
AC_MSG_RESULT([found $icu_version_full])
AC_MSG_RESULT([found $ICU_VERSION])
if test "$icu_version" -lt "4000"; then
AC_MSG_ERROR([ICU version 4.0 or later is required])
PHP_EVAL_LIBLINE($ICU_LIBS, $1)
PHP_EVAL_INCLINE($ICU_INCS)
else
AC_MSG_ERROR([ICU version 4.0 or later required.])
fi
fi
dnl If pkg-config fails for some reason, revert to the old method
if test "$found_icu" = "no"; then
if test "$PHP_ICU_DIR" = "DEFAULT"; then
dnl Try to find icu-config
AC_PATH_PROG(ICU_CONFIG, icu-config, no, [$PATH:/usr/local/bin])
else
ICU_CONFIG="$PHP_ICU_DIR/bin/icu-config"
fi
ICU_VERSION=$icu_version
ICU_INCS=`$ICU_CONFIG --cppflags-searchpath`
ICU_LIBS=`$ICU_CONFIG --ldflags --ldflags-icuio`
PHP_EVAL_INCLINE($ICU_INCS)
PHP_EVAL_LIBLINE($ICU_LIBS, $1)
dnl Trust icu-config to know better what the install prefix is..
icu_install_prefix=`$ICU_CONFIG --prefix 2> /dev/null`
if test "$?" != "0" || test -z "$icu_install_prefix"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Unable to detect ICU prefix or $ICU_CONFIG failed. Please verify ICU install prefix and make sure icu-config works.])
else
AC_MSG_RESULT([$icu_install_prefix])
ICU_CXXFLAGS=`$ICU_CONFIG --cxxflags`
ICU_CXXFLAGS="$ICU_CXXFLAGS -DU_USING_ICU_NAMESPACE=1"
dnl Check ICU version
AC_MSG_CHECKING([for ICU 4.0 or greater])
icu_version_full=`$ICU_CONFIG --version`
ac_IFS=$IFS
IFS="."
set $icu_version_full
IFS=$ac_IFS
icu_version=`expr [$]1 \* 1000 + [$]2`
AC_MSG_RESULT([found $icu_version_full])
if test "$icu_version" -lt "4000"; then
AC_MSG_ERROR([ICU version 4.0 or later is required])
fi
ICU_VERSION=$icu_version
ICU_INCS=`$ICU_CONFIG --cppflags-searchpath`
ICU_LIBS=`$ICU_CONFIG --ldflags --ldflags-icuio`
PHP_EVAL_INCLINE($ICU_INCS)
PHP_EVAL_LIBLINE($ICU_LIBS, $1)
ICU_CXXFLAGS=`$ICU_CONFIG --cxxflags`
ICU_CXXFLAGS="$ICU_CXXFLAGS -DU_USING_ICU_NAMESPACE=1"
fi
fi
])
+1 -1
View File
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=1
PHP_RELEASE_VERSION=26
PHP_RELEASE_VERSION=32
PHP_EXTRA_VERSION=""
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
+56 -30
View File
@@ -1654,10 +1654,10 @@ static int exif_file_sections_free(image_info_type *ImageInfo)
/* {{{ exif_iif_add_value
Add a value to image_info
*/
static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, int motorola_intel)
static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, size_t value_len, int motorola_intel)
{
size_t idex;
void *vptr;
void *vptr, *vptr_end;
image_info_value *info_value;
image_info_data *info_data;
image_info_data *list;
@@ -1679,8 +1679,12 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
switch (format) {
case TAG_FMT_STRING:
if (length > value_len) {
exif_error_docref("exif_iif_add_value" EXIFERR_CC, image_info, E_WARNING, "length > value_len: %d > %zu", length, value_len);
value = NULL;
}
if (value) {
length = php_strnlen(value, length);
length = (int)php_strnlen(value, length);
info_value->s = estrndup(value, length);
info_data->length = length;
} else {
@@ -1702,6 +1706,10 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
if (!length)
break;
case TAG_FMT_UNDEFINED:
if (length > value_len) {
exif_error_docref("exif_iif_add_value" EXIFERR_CC, image_info, E_WARNING, "length > value_len: %d > %zu", length, value_len);
value = NULL;
}
if (value) {
if (tag == TAG_MAKER_NOTE) {
length = (int) php_strnlen(value, length);
@@ -1732,7 +1740,12 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
} else {
info_value = &info_data->value;
}
vptr_end = (char *) value + value_len;
for (idex=0,vptr=value; idex<(size_t)length; idex++,vptr=(char *) vptr + php_tiff_bytes_per_format[format]) {
if ((char *) vptr_end - (char *) vptr < php_tiff_bytes_per_format[format]) {
exif_error_docref("exif_iif_add_value" EXIFERR_CC, image_info, E_WARNING, "Value too short");
break;
}
if (length>1) {
info_value = &info_data->value.list[idex];
}
@@ -1768,7 +1781,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
php_error_docref(NULL, E_WARNING, "Found value of type single");
#endif
info_value->f = *(float *)value;
break;
case TAG_FMT_DOUBLE:
#ifdef EXIF_DEBUG
php_error_docref(NULL, E_WARNING, "Found value of type double");
@@ -1786,9 +1799,9 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
/* {{{ exif_iif_add_tag
Add a tag from IFD to image_info
*/
static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value)
static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value, size_t value_len)
{
exif_iif_add_value(image_info, section_index, name, tag, format, (int)length, value, image_info->motorola_intel);
exif_iif_add_value(image_info, section_index, name, tag, format, (int)length, value, value_len, image_info->motorola_intel);
}
/* }}} */
@@ -2209,7 +2222,7 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
*/
static void exif_process_COM (image_info_type *image_info, char *value, size_t length)
{
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2);
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2, length-2);
}
/* }}} */
@@ -2224,17 +2237,17 @@ static void exif_process_CME (image_info_type *image_info, char *value, size_t l
if (length>3) {
switch(value[2]) {
case 0:
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value);
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value, length);
break;
case 1:
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length, value);
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length, value, length);
break;
default:
php_error_docref(NULL, E_NOTICE, "Undefined JPEG2000 comment encoding");
break;
}
} else {
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, 0, NULL);
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, 0, NULL, 0);
php_error_docref(NULL, E_NOTICE, "JPEG2000 comment section too small");
}
}
@@ -2606,7 +2619,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
{
int a;
char *decode;
size_t len;;
size_t len;
*pszEncoding = NULL;
/* Copy the comment */
@@ -2619,11 +2632,11 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
/* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
* since we have no encoding support for the BOM yet we skip that.
*/
if (!memcmp(szValuePtr, "\xFE\xFF", 2)) {
if (ByteCount >=2 && !memcmp(szValuePtr, "\xFE\xFF", 2)) {
decode = "UCS-2BE";
szValuePtr = szValuePtr+2;
ByteCount -= 2;
} else if (!memcmp(szValuePtr, "\xFF\xFE", 2)) {
} else if (ByteCount >=2 && !memcmp(szValuePtr, "\xFF\xFE", 2)) {
decode = "UCS-2LE";
szValuePtr = szValuePtr+2;
ByteCount -= 2;
@@ -2741,7 +2754,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
break;
}
if (maker_note->offset >= value_len) {
if (value_len < 2 || maker_note->offset >= value_len - 1) {
/* Do not go past the value end */
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data too short: 0x%04X offset 0x%04X", value_len, maker_note->offset);
return FALSE;
@@ -2794,6 +2807,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
break;
default:
case MN_OFFSET_NORMAL:
data_len = value_len;
break;
}
@@ -2801,6 +2815,10 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 2 + 0x%04X*12 = 0x%04X > 0x%04X", NumDirEntries, 2+NumDirEntries*12, value_len);
return FALSE;
}
if ((dir_start - value_ptr) > value_len - (2+NumDirEntries*12)) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 0x%04X > 0x%04X", (dir_start - value_ptr) + (2+NumDirEntries*12), value_len);
return FALSE;
}
for (de=0;de<NumDirEntries;de++) {
if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
@@ -2822,7 +2840,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table)
{
size_t length;
int tag, format, components;
unsigned int tag, format, components;
char *value_ptr, tagname[64], cbuf[32], *outside=NULL;
size_t byte_count, offset_val, fpos, fgot;
int64_t byte_count_signed;
@@ -2873,7 +2891,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
offset_base is ImageInfo->file.list[sn].data-dir_offset
dir_entry - offset_base is dir_offset+2+i*12
*/
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) {
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base) || dir_entry <= offset_base) {
/* It is important to check for IMAGE_FILETYPE_TIFF
* JPEG does not use absolute pointers instead its pointers are
* relative to the start of the TIFF header in APP1 section. */
@@ -3133,7 +3151,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
}
}
}
exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_table), tag, format, components, value_ptr);
exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_table), tag, format, components, value_ptr, byte_count);
EFREE_IF(outside);
return TRUE;
}
@@ -3291,10 +3309,10 @@ static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, size_t
size_t l1, l2=0;
if ((l1 = php_strnlen(buffer+2, length-2)) > 0) {
exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2);
exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2, l1);
if (length > 2+l1+1) {
l2 = php_strnlen(buffer+2+l1+1, length-2-l1-1);
exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1);
exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1, l2);
}
}
#ifdef EXIF_DEBUG
@@ -3480,7 +3498,7 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
size_t length=2, pos=0;
jpeg_sof_info sof_info;
if (!data) {
if (!data || ImageInfo->Thumbnail.size < 4) {
return FALSE; /* nothing to do here */
}
if (memcmp(data, "\xFF\xD8\xFF", 3)) {
@@ -3508,8 +3526,10 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
if (c == 0xFF)
return FALSE;
marker = c;
if (pos>=ImageInfo->Thumbnail.size)
return FALSE;
length = php_jpg_get16(data+pos);
if (pos+length>=ImageInfo->Thumbnail.size) {
if (length > ImageInfo->Thumbnail.size || pos >= ImageInfo->Thumbnail.size - length) {
return FALSE;
}
#ifdef EXIF_DEBUG
@@ -3530,6 +3550,10 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
case M_SOF14:
case M_SOF15:
/* handle SOFn block */
if (length < 8 || ImageInfo->Thumbnail.size - 8 < pos) {
/* exif_process_SOFn needs 8 bytes */
return FALSE;
}
exif_process_SOFn(data+pos, marker, &sof_info);
ImageInfo->Thumbnail.height = sof_info.height;
ImageInfo->Thumbnail.width = sof_info.width;
@@ -3567,10 +3591,10 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
tag_table_type tag_table = exif_get_tag_table(section_index);
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
return FALSE;
}
return FALSE;
}
if (ImageInfo->FileSize >= dir_offset+2) {
if (ImageInfo->FileSize >= 2 && ImageInfo->FileSize - 2 >= dir_offset) {
sn = exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL);
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, 2);
@@ -3578,8 +3602,8 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
php_stream_seek(ImageInfo->infile, dir_offset, SEEK_SET); /* we do not know the order of sections */
php_stream_read(ImageInfo->infile, (char*)ImageInfo->file.list[sn].data, 2);
num_entries = php_ifd_get16u(ImageInfo->file.list[sn].data, ImageInfo->motorola_intel);
dir_size = 2/*num dir entries*/ +12/*length of entry*/*num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/;
if (ImageInfo->FileSize >= dir_offset+dir_size) {
dir_size = 2/*num dir entries*/ +12/*length of entry*/*(size_t)num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/;
if (ImageInfo->FileSize >= dir_size && ImageInfo->FileSize - dir_size >= dir_offset) {
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X), IFD entries(%d)", ImageInfo->FileSize, dir_offset+2, dir_size-2, num_entries);
#endif
@@ -3662,9 +3686,9 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
}
}
}
if (ImageInfo->FileSize >= dir_offset + ImageInfo->file.list[sn].size) {
if (ImageInfo->FileSize >= ImageInfo->file.list[sn].size && ImageInfo->FileSize - ImageInfo->file.list[sn].size >= dir_offset) {
if (ifd_size > dir_size) {
if (dir_offset + ifd_size > ImageInfo->FileSize) {
if (ImageInfo->FileSize < ifd_size || dir_offset > ImageInfo->FileSize - ifd_size) {
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Error in TIFF: filesize(x%04X) less than size of IFD(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, ifd_size);
return FALSE;
}
@@ -4091,7 +4115,7 @@ PHP_FUNCTION(exif_read_data)
if (ImageInfo.Thumbnail.size) {
if (read_thumbnail) {
/* not exif_iif_add_str : this is a buffer */
exif_iif_add_tag(&ImageInfo, SECTION_THUMBNAIL, "THUMBNAIL", TAG_NONE, TAG_FMT_UNDEFINED, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.data);
exif_iif_add_tag(&ImageInfo, SECTION_THUMBNAIL, "THUMBNAIL", TAG_NONE, TAG_FMT_UNDEFINED, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size);
}
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
/* try to evaluate if thumbnail data is present */
@@ -4177,7 +4201,9 @@ PHP_FUNCTION(exif_thumbnail)
ZVAL_STRINGL(return_value, ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size);
if (arg_c >= 3) {
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
exif_scan_thumbnail(&ImageInfo);
if (!exif_scan_thumbnail(&ImageInfo)) {
ImageInfo.Thumbnail.width = ImageInfo.Thumbnail.height = 0;
}
}
zval_dtor(p_width);
zval_dtor(p_height);
Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug 77540 (Invalid Read on exif_process_SOFn)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
$width = $height = 42;
$s = exif_thumbnail(__DIR__."/bug77540.jpg", $width, $height);
echo "Width ".$width."\n";
echo "Height ".$height."\n";
?>
DONE
--EXPECTF--
Width 0
Height 0
DONE
Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug 77563 (Uninitialized read in exif_process_IFD_in_MAKERNOTE)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
$s = exif_thumbnail(__DIR__."/bug77563.jpg");
?>
DONE
--EXPECTF--
Warning: exif_thumbnail(bug77563.jpg): IFD data too short: 0x0009 offset 0x0008 in %s/bug77563.php on line %d
Warning: exif_thumbnail(bug77563.jpg): File structure corrupted in %s/bug77563.php on line %d
Warning: exif_thumbnail(bug77563.jpg): Invalid JPEG file in %s/bug77563.php on line %d
DONE
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #77753 (Heap-buffer-overflow in php_ifd_get32s)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
var_dump(exif_read_data(__DIR__."/bug77753.tiff"));
?>
DONE
--EXPECTF--
%A
Warning: exif_read_data(bug77753.tiff): Illegal IFD size: 0x006A > 0x0065 in %sbug77753.php on line %d
Warning: exif_read_data(bug77753.tiff): Invalid TIFF file in %sbug77753.php on line %d
bool(false)
DONE
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
--TEST--
Bug #77831 (Heap-buffer-overflow in exif_iif_add_value in EXIF)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
var_dump(exif_read_data(__DIR__."/bug77831.tiff"));
?>
DONE
--EXPECTF--
%A
bool(false)
DONE
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
--TEST--
Bug #77950 (Heap-buffer-overflow in _estrndup via exif_process_IFD_TAG)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
exif_read_data(__DIR__."/bug77950.tiff");
?>
DONE
--EXPECTF--
%A
DONE
Binary file not shown.
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
--TEST--
Bug #77988 (heap-buffer-overflow on php_jpg_get16)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
exif_read_data(__DIR__."/bug77988.jpg", 'COMMENT', FALSE, TRUE);
?>
DONE
--EXPECTF--
DONE
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
--TEST--
Bug #78222 (heap-buffer-overflow on exif_scan_thumbnail)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
exif_read_data(__DIR__."/bug78222.jpg", 'THUMBNAIL', FALSE, TRUE);
?>
DONE
--EXPECTF--
DONE
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
--TEST--
Bug #78256 (heap-buffer-overflow on exif_process_user_comment)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
@exif_read_data(__DIR__."/bug78256.jpg", 'COMMENT', FALSE, TRUE);
?>
DONE
--EXPECTF--
DONE
+5 -1
View File
@@ -135,7 +135,11 @@ gdImagePtr gdImageCreateFromXbm(FILE * fd)
}
h[3] = ch;
}
sscanf(h, "%x", &b);
if (sscanf(h, "%x", &b) != 1) {
php_gd_error("invalid XBM");
gdImageDestroy(im);
return 0;
}
for (bit = 1; bit <= max_bit; bit = bit << 1) {
gdImageSetPixel(im, x++, y, (b & bit) ? 1 : 0);
if (x == im->sx) {
+26
View File
@@ -0,0 +1,26 @@
--TEST--
Bug #77973 (Uninitialized read in gdImageCreateFromXbm)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die("skip gd extension not available");
if (!function_exists('imagecreatefromxbm')) die("skip imagecreatefromxbm not available");
?>
--FILE--
<?php
$contents = hex2bin("23646566696e6520776964746820320a23646566696e652068656967687420320a737461746963206368617220626974735b5d203d7b0a7a7a787a7a");
$filepath = __DIR__ . '/bug77973.xbm';
file_put_contents($filepath, $contents);
$im = imagecreatefromxbm($filepath);
var_dump($im);
?>
===DONE===
--EXPECTF--
Warning: imagecreatefromxbm(): invalid XBM in %s on line %d
Warning: imagecreatefromxbm(): '%s' is not a valid XBM file in %s on line %d
bool(false)
===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/bug77973.xbm');
?>
+1 -1
View File
@@ -191,7 +191,7 @@ static void PHP_SHA3_Final(unsigned char* digest,
}
// Zero out context
memset(ctx, 0, sizeof(PHP_SHA3_CTX));
ZEND_SECURE_ZERO(ctx, sizeof(PHP_SHA3_CTX));
}
// ==========================================================================
+1 -1
View File
@@ -129,7 +129,7 @@ static inline void SnefruTransform(PHP_SNEFRU_CTX *context, const unsigned char
((input[i+2] & 0xff) << 8) | (input[i+3] & 0xff);
}
Snefru(context->state);
memset(&context->state[8], 0, sizeof(uint32_t) * 8);
ZEND_SECURE_ZERO(&context->state[8], sizeof(uint32_t) * 8);
}
PHP_HASH_API void PHP_SNEFRUInit(PHP_SNEFRU_CTX *context)
+3 -1
View File
@@ -1673,7 +1673,9 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
* we can do at this point. */
if (*(p1 + 1) == '=') {
++p1;
--str_left;
if (str_left > 1) {
--str_left;
}
}
err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Bug #78069 (Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow)
--SKIPIF--
<?php
if (!extension_loaded('iconv')) die('skip ext/iconv required');
?>
--FILE--
<?php
$hdr = iconv_mime_decode_headers(file_get_contents(__DIR__ . "/bug78069.data"),2);
var_dump(count($hdr));
?>
DONE
--EXPECT--
int(1)
DONE
+3 -3
View File
@@ -29,6 +29,7 @@
#include "regint.h"
#if 0
static void
conv_ext0be32(const UChar* s, const UChar* end, UChar* conv)
{
@@ -158,6 +159,7 @@ conv_encoding(OnigEncoding from, OnigEncoding to, const UChar* s, const UChar* e
return ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION;
}
#endif
extern int
onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
@@ -169,9 +171,7 @@ onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
if (IS_NOT_NULL(einfo)) einfo->par = (UChar* )NULL;
if (ci->pattern_enc != ci->target_enc) {
r = conv_encoding(ci->pattern_enc, ci->target_enc, pattern, pattern_end,
&cpat, &cpat_end);
if (r) return r;
return ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION;
}
else {
cpat = (UChar* )pattern;
+17 -3
View File
@@ -451,13 +451,18 @@ static php_mb_regex_t *php_mbregex_compile_pattern(const char *pattern, int patl
OnigErrorInfo err_info;
OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN];
if (!php_mb_check_encoding(pattern, patlen, _php_mb_regex_mbctype2name(enc))) {
php_error_docref(NULL, E_WARNING,
"Pattern is not valid under %s encoding", _php_mb_regex_mbctype2name(enc));
return NULL;
}
rc = zend_hash_str_find_ptr(&MBREX(ht_rc), (char *)pattern, patlen);
if (!rc || onig_get_options(rc) != options || onig_get_encoding(rc) != enc || onig_get_syntax(rc) != syntax) {
if ((err_code = onig_new(&retval, (OnigUChar *)pattern, (OnigUChar *)(pattern + patlen), options, enc, syntax, &err_info)) != ONIG_NORMAL) {
onig_error_code_to_str(err_str, err_code, &err_info);
php_error_docref(NULL, E_WARNING, "mbregex compile err: %s", err_str);
retval = NULL;
goto out;
return NULL;
}
if (rc == MBREX(search_re)) {
/* reuse the new rc? see bug #72399 */
@@ -467,7 +472,6 @@ static php_mb_regex_t *php_mbregex_compile_pattern(const char *pattern, int patl
} else {
retval = rc;
}
out:
return retval;
}
/* }}} */
@@ -1110,6 +1114,11 @@ PHP_FUNCTION(mb_split)
count--;
}
if (!php_mb_check_encoding(string, string_len,
_php_mb_regex_mbctype2name(MBREX(current_mbctype)))) {
RETURN_FALSE;
}
/* create regex pattern buffer */
if ((re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, MBREX(regex_default_options), MBREX(current_mbctype), MBREX(regex_default_syntax))) == NULL) {
RETURN_FALSE;
@@ -1199,6 +1208,11 @@ PHP_FUNCTION(mb_ereg_match)
}
}
if (!php_mb_check_encoding(string, string_len,
_php_mb_regex_mbctype2name(MBREX(current_mbctype)))) {
RETURN_FALSE;
}
if ((re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, option, MBREX(current_mbctype), syntax)) == NULL) {
RETURN_FALSE;
}
+3 -1
View File
@@ -13,5 +13,7 @@ var_dump($var1);
===DONE===
--EXPECTF--
Notice: Undefined variable: var in %s on line %d
string(0) ""
Warning: mbereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)
===DONE===
+3 -5
View File
@@ -6,8 +6,6 @@ Bug #77370 (Buffer overflow on mb regex functions - fetch_token)
<?php
var_dump(mb_split(" \xfd",""));
?>
--EXPECT--
array(1) {
[0]=>
string(0) ""
}
--EXPECTF--
Warning: mb_split(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)
+3 -2
View File
@@ -6,5 +6,6 @@ Bug #77371 (heap buffer overflow in mb regex functions - compile_string_node)
<?php
var_dump(mb_ereg("()0\xfc00000\xfc00000\xfc00000\xfc",""));
?>
--EXPECT--
bool(false)
--EXPECTF--
Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)
+9 -2
View File
@@ -9,8 +9,15 @@ var_dump(mb_ereg("(?i)000000000000000000000\xf0",""));
var_dump(mb_ereg("0000\\"."\xf5","0"));
var_dump(mb_ereg("(?i)FFF00000000000000000\xfd",""));
?>
--EXPECT--
int(1)
--EXPECTF--
Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)
Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)
Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)
Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)
+2 -5
View File
@@ -1,5 +1,5 @@
--TEST--
Bug #77371 (Heap overflow in utf32be_mbc_to_code)
Bug #77418 (Heap overflow in utf32be_mbc_to_code)
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--FILE--
@@ -8,7 +8,4 @@ mb_regex_encoding("UTF-32");
var_dump(mb_split("\x00\x00\x00\x5c\x00\x00\x00B","000000000000000000000000000000"));
?>
--EXPECT--
array(1) {
[0]=>
string(30) "000000000000000000000000000000"
}
bool(false)
@@ -109,13 +109,17 @@ string(10) "string_val"
string(10) "string_val"
-- Iteration 4 --
string(10) "string_val"
Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)
-- Iteration 5 --
string(10) "string_val"
-- Iteration 6 --
string(10) "string_val"
Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)
-- Iteration 7 --
string(10) "string_val"
+2
View File
@@ -605,6 +605,8 @@ PHP_FUNCTION(mcrypt_generic_init)
}
RETVAL_LONG(result);
ZEND_SECURE_ZERO(key_s, key_len);
ZEND_SECURE_ZERO(iv_s, iv_len);
efree(iv_s);
efree(key_s);
}
+1 -1
View File
@@ -6339,7 +6339,7 @@ static int php_openssl_cipher_update(const EVP_CIPHER *cipher_type,
{
int i = 0;
if (mode->is_single_run_aead && !EVP_EncryptUpdate(cipher_ctx, NULL, &i, NULL, (int)data_len)) {
if (mode->is_single_run_aead && !EVP_CipherUpdate(cipher_ctx, NULL, &i, NULL, (int)data_len)) {
php_openssl_store_errors();
php_error_docref(NULL, E_WARNING, "Setting of data length failed");
return FAILURE;
+10 -1
View File
@@ -483,7 +483,7 @@ static const char error_texts[] =
"lookbehind assertion is not fixed length\0"
"malformed number or name after (?(\0"
"conditional group contains more than two branches\0"
"assertion expected after (?(\0"
"assertion expected after (?( or (?(?C)\0"
"(?R or (?[+-]digits must be followed by )\0"
/* 30 */
"unknown POSIX class name\0"
@@ -6732,6 +6732,15 @@ for (;; ptr++)
for (i = 3;; i++) if (!IS_DIGIT(ptr[i])) break;
if (ptr[i] == CHAR_RIGHT_PARENTHESIS)
tempptr += i + 1;
/* tempptr should now be pointing to the opening parenthesis of the
assertion condition. */
if (*tempptr != CHAR_LEFT_PARENTHESIS)
{
*errorcodeptr = ERR28;
goto FAILED;
}
}
/* For conditions that are assertions, check the syntax, and then exit
+10
View File
@@ -0,0 +1,10 @@
--TEST--
Bug #75457 (heap-use-after-free in php7.0.25)
--FILE--
<?php
$pattern = "/(((?(?C)0?=))(?!()0|.(?0)0)())/";
var_dump(preg_match($pattern, "hello"));
?>
--EXPECTF--
Warning: preg_match(): Compilation failed: assertion expected after (?( or (?(?C) at offset 4 in %sbug75457.php on line %d
bool(false)
+3
View File
@@ -1385,6 +1385,9 @@ int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int a
/* set up our manifest */
mydata = ecalloc(1, sizeof(phar_archive_data));
mydata->fname = expand_filepath(fname, NULL);
if (mydata->fname == NULL) {
return FAILURE;
}
fname_len = strlen(mydata->fname);
#ifdef PHP_WIN32
phar_unixify_path_separators(mydata->fname, fname_len);
+3 -1
View File
@@ -2037,7 +2037,7 @@ static zend_object *phar_rename_archive(phar_archive_data **sphar, char *ext, ze
char *newname = NULL, *newpath = NULL;
zval ret, arg1;
zend_class_entry *ce;
char *error;
char *error = NULL;
const char *pcr_error;
int ext_len = ext ? strlen(ext) : 0;
size_t new_len, oldname_len;
@@ -2205,6 +2205,8 @@ its_ok:
phar_flush(phar, 0, 0, 1, &error);
if (error) {
zend_hash_str_del(&(PHAR_G(phar_fname_map)), newpath, phar->fname_len);
*sphar = NULL;
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s", error);
efree(error);
efree(oldpath);
+6 -1
View File
@@ -762,7 +762,12 @@ static int phar_tar_writeheaders_int(phar_entry_info *entry, void *argument) /*
header.typeflag = entry->tar_type;
if (entry->link) {
strncpy(header.linkname, entry->link, strlen(entry->link));
if (strlcpy(header.linkname, entry->link, sizeof(header.linkname)) >= sizeof(header.linkname)) {
if (fp->error) {
spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, link \"%s\" is too long for format", entry->phar->fname, entry->link);
}
return ZEND_HASH_APPLY_STOP;
}
}
strncpy(header.magic, "ustar", sizeof("ustar")-1);
+6 -2
View File
@@ -13,5 +13,9 @@ DONE
<?php
@unlink(__DIR__."/bug71488.test");
?>
--EXPECT--
DONE
--EXPECTF--
Fatal error: Uncaught BadMethodCallException: tar-based phar "%s/bug71488.test" cannot be created, link "%s" is too long for format in %sbug71488.php:%d
Stack trace:
#0 %s(%d): PharData->decompress('test')
#1 {main}
thrown in %s on line %d
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Bug #77396 Relative filename exceeding maximum path length causes null pointer dereference.
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--FILE--
<?php
$path = '../' . str_repeat("x", PHP_MAXPATHLEN) . '.tar';
$phar = new PharData($path);
?>
--EXPECTF--
Fatal error: Uncaught UnexpectedValueException: Phar creation or opening failed in %s/bug77396.php:%d
Stack trace:
#0 %s/bug77396.php(%d): PharData->__construct(%s)
#1 {main}
thrown in %s/bug77396.php on line %d
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug #77586 Symbolic link names in tar-formatted phar must be less than 100 bytes.
--SKIPIF--
<?php if (!extension_loaded("phar") || true /* blocked by bug 65332 */) die("skip"); ?>
--FILE--
<?php
$dir = __DIR__."/bug77586";
$phar = new PharData($dir . "/bug77586.tar");
$phar->buildFromDirectory($dir . "/files");
?>
--CLEAN--
<?php
$dir = __DIR__."/bug77586";
unlink($dir . "/bug77586.tar");
?>
--EXPECTF--
Fatal error: Uncaught PharException: tar-based phar "%s/bug77586.tar" cannot be created, link "%s" is too long for format %s
Stack trace:
#0 %s/bug77586.php(%d): PharData->buildFromDirectory('%s')
#1 {main}
thrown in %s/bug77586.php %s on line %d
+1 -1
View File
@@ -1110,7 +1110,7 @@ SPL_METHOD(SplFileInfo, __construct)
char *path;
size_t len;
if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s", &path, &len) == FAILURE) {
if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "p", &path, &len) == FAILURE) {
return;
}
+9
View File
@@ -0,0 +1,9 @@
--TEST--
Bug #77431 (SplFileInfo::__construct() accepts NUL bytes)
--FILE--
<?php
new SplFileInfo("bad\0good");
?>
--EXPECTF--
Fatal error: Uncaught TypeError: SplFileInfo::__construct() expects parameter 1 to be a valid path, string given in %s:%d
Stack trace:%A
+41146 -17754
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+79 -5
View File
@@ -134,7 +134,7 @@ struct sqlite3_api_routines {
int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,
const char*,const char*),void*);
void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
char * (*snprintf)(int,char*,const char*,...);
char * (*xsnprintf)(int,char*,const char*,...);
int (*step)(sqlite3_stmt*);
int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,
char const**,char const**,int*,int*,int*);
@@ -246,7 +246,7 @@ struct sqlite3_api_routines {
int (*uri_boolean)(const char*,const char*,int);
sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
const char *(*uri_parameter)(const char*,const char*);
char *(*vsnprintf)(int,char*,const char*,va_list);
char *(*xvsnprintf)(int,char*,const char*,va_list);
int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
/* Version 3.8.7 and later */
int (*auto_extension)(void(*)(void));
@@ -282,6 +282,46 @@ struct sqlite3_api_routines {
/* Version 3.14.0 and later */
int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
char *(*expanded_sql)(sqlite3_stmt*);
/* Version 3.18.0 and later */
void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64);
/* Version 3.20.0 and later */
int (*prepare_v3)(sqlite3*,const char*,int,unsigned int,
sqlite3_stmt**,const char**);
int (*prepare16_v3)(sqlite3*,const void*,int,unsigned int,
sqlite3_stmt**,const void**);
int (*bind_pointer)(sqlite3_stmt*,int,void*,const char*,void(*)(void*));
void (*result_pointer)(sqlite3_context*,void*,const char*,void(*)(void*));
void *(*value_pointer)(sqlite3_value*,const char*);
int (*vtab_nochange)(sqlite3_context*);
int (*value_nochange)(sqlite3_value*);
const char *(*vtab_collation)(sqlite3_index_info*,int);
/* Version 3.24.0 and later */
int (*keyword_count)(void);
int (*keyword_name)(int,const char**,int*);
int (*keyword_check)(const char*,int);
sqlite3_str *(*str_new)(sqlite3*);
char *(*str_finish)(sqlite3_str*);
void (*str_appendf)(sqlite3_str*, const char *zFormat, ...);
void (*str_vappendf)(sqlite3_str*, const char *zFormat, va_list);
void (*str_append)(sqlite3_str*, const char *zIn, int N);
void (*str_appendall)(sqlite3_str*, const char *zIn);
void (*str_appendchar)(sqlite3_str*, int N, char C);
void (*str_reset)(sqlite3_str*);
int (*str_errcode)(sqlite3_str*);
int (*str_length)(sqlite3_str*);
char *(*str_value)(sqlite3_str*);
/* Version 3.25.0 and later */
int (*create_window_function)(sqlite3*,const char*,int,int,void*,
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*),
void (*xValue)(sqlite3_context*),
void (*xInv)(sqlite3_context*,int,sqlite3_value**),
void(*xDestroy)(void*));
/* Version 3.26.0 and later */
const char *(*normalized_sql)(sqlite3_stmt*);
/* Version 3.28.0 and later */
int (*stmt_isexplain)(sqlite3_stmt*);
int (*value_frombind)(sqlite3_value*);
};
/*
@@ -408,7 +448,7 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_rollback_hook sqlite3_api->rollback_hook
#define sqlite3_set_authorizer sqlite3_api->set_authorizer
#define sqlite3_set_auxdata sqlite3_api->set_auxdata
#define sqlite3_snprintf sqlite3_api->snprintf
#define sqlite3_snprintf sqlite3_api->xsnprintf
#define sqlite3_step sqlite3_api->step
#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata
#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup
@@ -432,7 +472,7 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_value_text16le sqlite3_api->value_text16le
#define sqlite3_value_type sqlite3_api->value_type
#define sqlite3_vmprintf sqlite3_api->vmprintf
#define sqlite3_vsnprintf sqlite3_api->vsnprintf
#define sqlite3_vsnprintf sqlite3_api->xvsnprintf
#define sqlite3_overload_function sqlite3_api->overload_function
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
@@ -508,7 +548,7 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_uri_boolean sqlite3_api->uri_boolean
#define sqlite3_uri_int64 sqlite3_api->uri_int64
#define sqlite3_uri_parameter sqlite3_api->uri_parameter
#define sqlite3_uri_vsnprintf sqlite3_api->vsnprintf
#define sqlite3_uri_vsnprintf sqlite3_api->xvsnprintf
#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2
/* Version 3.8.7 and later */
#define sqlite3_auto_extension sqlite3_api->auto_extension
@@ -540,6 +580,40 @@ typedef int (*sqlite3_loadext_entry)(
/* Version 3.14.0 and later */
#define sqlite3_trace_v2 sqlite3_api->trace_v2
#define sqlite3_expanded_sql sqlite3_api->expanded_sql
/* Version 3.18.0 and later */
#define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid
/* Version 3.20.0 and later */
#define sqlite3_prepare_v3 sqlite3_api->prepare_v3
#define sqlite3_prepare16_v3 sqlite3_api->prepare16_v3
#define sqlite3_bind_pointer sqlite3_api->bind_pointer
#define sqlite3_result_pointer sqlite3_api->result_pointer
#define sqlite3_value_pointer sqlite3_api->value_pointer
/* Version 3.22.0 and later */
#define sqlite3_vtab_nochange sqlite3_api->vtab_nochange
#define sqlite3_value_nochange sqlite3_api->value_nochange
#define sqlite3_vtab_collation sqlite3_api->vtab_collation
/* Version 3.24.0 and later */
#define sqlite3_keyword_count sqlite3_api->keyword_count
#define sqlite3_keyword_name sqlite3_api->keyword_name
#define sqlite3_keyword_check sqlite3_api->keyword_check
#define sqlite3_str_new sqlite3_api->str_new
#define sqlite3_str_finish sqlite3_api->str_finish
#define sqlite3_str_appendf sqlite3_api->str_appendf
#define sqlite3_str_vappendf sqlite3_api->str_vappendf
#define sqlite3_str_append sqlite3_api->str_append
#define sqlite3_str_appendall sqlite3_api->str_appendall
#define sqlite3_str_appendchar sqlite3_api->str_appendchar
#define sqlite3_str_reset sqlite3_api->str_reset
#define sqlite3_str_errcode sqlite3_api->str_errcode
#define sqlite3_str_length sqlite3_api->str_length
#define sqlite3_str_value sqlite3_api->str_value
/* Version 3.25.0 and later */
#define sqlite3_create_window_function sqlite3_api->create_window_function
/* Version 3.26.0 and later */
#define sqlite3_normalized_sql sqlite3_api->normalized_sql
/* Version 3.28.0 and later */
#define sqlite3_stmt_isexplain sqlite3_api->isexplain
#define sqlite3_value_frombind sqlite3_api->frombind
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
+1
View File
@@ -28,6 +28,7 @@ extern zend_module_entry sqlite3_module_entry;
ZEND_BEGIN_MODULE_GLOBALS(sqlite3)
char *extension_dir;
int dbconfig_defensive;
ZEND_END_MODULE_GLOBALS(sqlite3)
#ifdef ZTS
+18
View File
@@ -81,6 +81,9 @@ static void php_sqlite3_error(php_sqlite3_db_object *db_obj, char *format, ...)
*/
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("sqlite3.extension_dir", NULL, PHP_INI_SYSTEM, OnUpdateString, extension_dir, zend_sqlite3_globals, sqlite3_globals)
#if SQLITE_VERSION_NUMBER >= 3026000
STD_PHP_INI_ENTRY("sqlite3.defensive", "1", PHP_INI_SYSTEM, OnUpdateBool, dbconfig_defensive, zend_sqlite3_globals, sqlite3_globals)
#endif
PHP_INI_END()
/* }}} */
@@ -166,6 +169,12 @@ PHP_METHOD(sqlite3, open)
sqlite3_set_authorizer(db_obj->db, php_sqlite3_authorizer, NULL);
}
#if SQLITE_VERSION_NUMBER >= 3026000
if (SQLITE3G(dbconfig_defensive)) {
sqlite3_db_config(db_obj->db, SQLITE_DBCONFIG_DEFENSIVE, 1, NULL);
}
#endif
if (fullpath != filename) {
efree(fullpath);
}
@@ -2025,6 +2034,15 @@ static int php_sqlite3_authorizer(void *autharg, int access_type, const char *ar
case SQLITE_ATTACH:
{
if (memcmp(arg3, ":memory:", sizeof(":memory:")) && *arg3) {
if (strncmp(arg3, "file:", 5) == 0) {
/* starts with "file:" */
if (!arg3[5]) {
return SQLITE_DENY;
}
if (php_check_open_basedir(arg3 + 5)) {
return SQLITE_DENY;
}
}
if (php_check_open_basedir(arg3)) {
return SQLITE_DENY;
}
+40
View File
@@ -0,0 +1,40 @@
--TEST--
SQLite3 defensive mode ini setting
--SKIPIF--
<?php require_once(__DIR__ . '/skipif.inc');
if (SQLite3::version()['versionNumber'] < 3026000) {
die("skip: sqlite3 library version < 3.26: no support for defensive mode");
}
?>
--INI--
sqlite3.defensive=On
--FILE--
<?php
$db = new SQLite3(':memory:');
var_dump($db->exec('CREATE TABLE test (a, b);'));
// This does not generate an error!
var_dump($db->exec('PRAGMA writable_schema = ON;'));
var_dump($db->querySingle('PRAGMA writable_schema;'));
// Should be 1
var_dump($db->querySingle('SELECT COUNT(*) FROM sqlite_master;'));
// Should generate an error!
var_dump($db->querySingle('DELETE FROM sqlite_master;'));
// Should still be 1
var_dump($db->querySingle('SELECT COUNT(*) FROM sqlite_master;'));
?>
--EXPECTF--
bool(true)
bool(true)
int(1)
int(1)
Warning: SQLite3::querySingle(): Unable to prepare statement: 1, table sqlite_master may not be modified in %s on line %d
bool(false)
int(1)
+6 -6
View File
@@ -1,11 +1,11 @@
/*
/*
DO NOT EDIT THIS FILE!
it has been automaticaly created by php7/scripts/credits from
it has been automaticaly created by php7/scripts/credits from
the information found in the various php7/ext/.../CREDITS and
php7/sapi/.../CREDITS files
if you want to change an entry you have to edit the appropriate
php7/sapi/.../CREDITS files
if you want to change an entry you have to edit the appropriate
CREDITS file instead
*/
@@ -28,7 +28,7 @@ CREDIT_LINE("FTP", "Stefan Esser, Andrew Skalski");
CREDIT_LINE("GD imaging", "Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye, Marcus Boerger");
CREDIT_LINE("GetText", "Alex Plotnick");
CREDIT_LINE("GNU GMP support", "Stanislav Malyshev");
CREDIT_LINE("Iconv", "Rui Hirokawa, Stig Bakken, Moriyoshi Koizumi");
CREDIT_LINE("Iconv", "Rui Hirokawa, Stig Bakken, Moriyoshi Koizumi ");
CREDIT_LINE("IMAP", "Rex Logan, Mark Musone, Brian Wang, Kaj-Michael Lang, Antoni Pamies Olive, Rasmus Lerdorf, Andrew Skalski, Chuck Hagenbuch, Daniel R Kalowsky");
CREDIT_LINE("Input Filter", "Rasmus Lerdorf, Derick Rethans, Pierre-Alain Joye, Ilia Alshanetsky");
CREDIT_LINE("InterBase", "Jouni Ahto, Andrew Avdeev, Ard Biesheuvel");
+5 -5
View File
@@ -1,11 +1,11 @@
/*
/*
DO NOT EDIT THIS FILE!
it has been automaticaly created by php7/scripts/credits from
it has been automaticaly created by php7/scripts/credits from
the information found in the various php7/ext/.../CREDITS and
php7/sapi/.../CREDITS files
if you want to change an entry you have to edit the appropriate
php7/sapi/.../CREDITS files
if you want to change an entry you have to edit the appropriate
CREDITS file instead
*/
+1 -1
View File
@@ -364,7 +364,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out)
PHP_MD5Update(&ctx, final, (unsigned int)(pl > 16 ? 16 : pl));
/* Don't leave anything around in vm they could use. */
memset(final, 0, sizeof(final));
ZEND_SECURE_ZERO(final, sizeof(final));
/* Then something really weird... */
for (i = pwl; i != 0; i >>= 1)
+2 -2
View File
@@ -245,7 +245,7 @@ PHPAPI void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX * context)
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
@@ -356,7 +356,7 @@ const unsigned char block[64];
state[4] += e;
/* Zeroize sensitive information. */
memset((unsigned char*) x, 0, sizeof(x));
ZEND_SECURE_ZERO((unsigned char*) x, sizeof(x));
}
/* }}} */
+3 -3
View File
@@ -2,7 +2,7 @@
/* edit configure.in to change version number */
#define PHP_MAJOR_VERSION 7
#define PHP_MINOR_VERSION 1
#define PHP_RELEASE_VERSION 26
#define PHP_RELEASE_VERSION 32
#define PHP_EXTRA_VERSION ""
#define PHP_VERSION "7.1.26"
#define PHP_VERSION_ID 70126
#define PHP_VERSION "7.1.32"
#define PHP_VERSION_ID 70132
+36 -19
View File
@@ -1168,34 +1168,51 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f
# ifdef EXDEV
if (errno == EXDEV) {
zend_stat_t sb;
# if !defined(ZTS) && !defined(TSRM_WIN32) && !defined(NETWARE)
/* not sure what to do in ZTS case, umask is not thread-safe */
int oldmask = umask(077);
# endif
int success = 0;
if (php_copy_file(url_from, url_to) == SUCCESS) {
if (VCWD_STAT(url_from, &sb) == 0) {
success = 1;
# if !defined(TSRM_WIN32) && !defined(NETWARE)
if (VCWD_CHMOD(url_to, sb.st_mode)) {
if (errno == EPERM) {
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
VCWD_UNLINK(url_from);
return 1;
}
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
return 0;
}
/*
* Try to set user and permission info on the target.
* If we're not root, then some of these may fail.
* We try chown first, to set proper group info, relying
* on the system environment to have proper umask to not allow
* access to the file in the meantime.
*/
if (VCWD_CHOWN(url_to, sb.st_uid, sb.st_gid)) {
if (errno == EPERM) {
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
VCWD_UNLINK(url_from);
return 1;
}
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
return 0;
if (errno != EPERM) {
success = 0;
}
}
if (success) {
if (VCWD_CHMOD(url_to, sb.st_mode)) {
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
if (errno != EPERM) {
success = 0;
}
}
}
# endif
VCWD_UNLINK(url_from);
return 1;
if (success) {
VCWD_UNLINK(url_from);
}
} else {
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
}
} else {
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
}
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
return 0;
# if !defined(ZTS) && !defined(TSRM_WIN32) && !defined(NETWARE)
umask(oldmask);
# endif
return success;
}
# endif
#endif
+11
View File
@@ -991,8 +991,19 @@ cli_server.color = On
;intl.use_exceptions = 0
[sqlite3]
; Directory pointing to SQLite3 extensions
; http://php.net/sqlite3.extension-dir
;sqlite3.extension_dir =
; SQLite defensive mode flag (only available from SQLite 3.26+)
; When the defensive flag is enabled, language features that allow ordinary
; SQL to deliberately corrupt the database file are disabled. This forbids
; writing directly to the schema, shadow tables (eg. FTS data tables), or
; the sqlite_dbpage virtual table.
; https://www.sqlite.org/c3ref/c_dbconfig_defensive.html
; (for older SQLite versions, this flag has no use)
sqlite3.defensive = 1
[Pcre]
;PCRE library backtracking limit.
; http://php.net/pcre.backtrack-limit
+11
View File
@@ -991,8 +991,19 @@ cli_server.color = On
;intl.use_exceptions = 0
[sqlite3]
; Directory pointing to SQLite3 extensions
; http://php.net/sqlite3.extension-dir
;sqlite3.extension_dir =
; SQLite defensive mode flag (only available from SQLite 3.26+)
; When the defensive flag is enabled, language features that allow ordinary
; SQL to deliberately corrupt the database file are disabled. This forbids
; writing directly to the schema, shadow tables (eg. FTS data tables), or
; the sqlite_dbpage virtual table.
; https://www.sqlite.org/c3ref/c_dbconfig_defensive.html
; (for older SQLite versions, this flag has no use)
sqlite3.defensive = 1
[Pcre]
;PCRE library backtracking limit.
; http://php.net/pcre.backtrack-limit
+7 -6
View File
@@ -274,8 +274,9 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
}
if (!found) {
if (headers_lc) {
zend_string_free(headers_lc);
if (headers) {
zend_string_release(headers_trim);
zend_string_release(headers_lc);
}
*error = W32_SM_SENDMAIL_FROM_NOT_SET;
return FAILURE;
@@ -289,8 +290,8 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
efree(RPath);
}
if (headers) {
zend_string_free(headers_trim);
zend_string_free(headers_lc);
zend_string_release(headers_trim);
zend_string_release(headers_lc);
}
/* 128 is safe here, the specifier in snprintf isn't longer than that */
if (NULL == (*error_message = ecalloc(1, HOST_NAME_LEN + 128))) {
@@ -308,8 +309,8 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
efree(RPath);
}
if (headers) {
zend_string_free(headers_trim);
zend_string_free(headers_lc);
zend_string_release(headers_trim);
zend_string_release(headers_lc);
}
if (ret != SUCCESS) {
*error = ret;