summaryrefslogtreecommitdiff
path: root/ext/fileinfo
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fileinfo')
-rw-r--r--ext/fileinfo/fileinfo.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index e42985012e..8f7e0aa8f3 100644
--- a/ext/fileinfo/fileinfo.c
+++ b/ext/fileinfo/fileinfo.c
@@ -23,6 +23,12 @@
#endif
#include <magic.h>
+// HOWMANY specifies the maximum offset libmagic will look at
+// this is currently hardcoded in the libmagic source but not exported
+#ifndef HOWMANY
+#define HOWMANY 65536
+#endif
+
#include "php.h"
#include "php_ini.h"
@@ -361,7 +367,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode)
if (!stream) {
RETURN_FALSE;
}
- buffer_len = php_stream_copy_to_mem(stream, &tmp, PHP_STREAM_COPY_ALL, 0);
+ buffer_len = php_stream_copy_to_mem(stream, &tmp, HOWMANY, 0); //
php_stream_close(stream);
if (buffer_len == 0) {