cvs: pecl /fileinfo fileinfo.c

From: Date: Wed, 21 Apr 2004 22:49:36 +0000
Subject: cvs: pecl /fileinfo fileinfo.c
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-1167@lists.php.net to get a copy of this message
hholzgra Wed Apr 21 18:49:36 2004 EDT Modified files: /pecl/fileinfo fileinfo.c Log: libmagic will only consume up to HOWMANY (hardcoded to 65536) bytes from a file, so lets save bandwith and memory by limiting us to this http://cvs.php.net/diff.php/pecl/fileinfo/fileinfo.c?r1=1.2&r2=1.3&ty=u Index: pecl/fileinfo/fileinfo.c diff -u pecl/fileinfo/fileinfo.c:1.2 pecl/fileinfo/fileinfo.c:1.3 --- pecl/fileinfo/fileinfo.c:1.2 Thu Feb 12 20:19:57 2004 +++ pecl/fileinfo/fileinfo.c Wed Apr 21 18:49:35 2004 @@ -16,13 +16,19 @@ +----------------------------------------------------------------------+ */ -/* $Id: fileinfo.c,v 1.2 2004/02/13 01:19:57 iliaa Exp $ */ +/* $Id: fileinfo.c,v 1.3 2004/04/21 22:49:35 hholzgra Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #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 @@ 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) {

« previous php.pecl.cvs (#1167) next »