From 4237ddadb5d56970d405c7329890b76568f6e390 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 10 Sep 2000 13:34:03 +0000 Subject: [PATCH] Fix pack() function reading string beyond the end --- ext/standard/pack.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 8e3a32d115..7afe52a6af 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -302,6 +302,10 @@ PHP_FUNCTION(pack) convert_to_string_ex(val); v = (*val)->value.str.val; outputpos--; + if(arg > (*val)->value.str.len) { + php_error(E_WARNING,"pack type %c: not enough characters in string",code); + arg = (*val)->value.str.len; + } while (arg-- > 0) { char n = *(v++); -- 2.50.1