From: foobar Date: Wed, 25 Feb 2004 12:36:24 +0000 (+0000) Subject: MFH: Fixed bug #27384 (unpack() misbehaves with 1 char string). (GeorgeS) X-Git-Tag: php-4.3.5RC4~66 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e1505662ad8d838bd0347e7f26ce01dbc3ccb476;p=php MFH: Fixed bug #27384 (unpack() misbehaves with 1 char string). (GeorgeS) --- diff --git a/NEWS b/NEWS index c41daa3a0e..d12ef3c31c 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Feb 2004, Version 4.3.5 +- Fixed bug #27384 (unpack() misbehaves with 1 char string). (GeorgeS) - Fixed bug #27383 (Potential crash inside fopen_wrapper, while parsing response code). (Ilia) - Fixed bug #27341 (HEAD requests fail to return data). (Ilia) diff --git a/ext/standard/pack.c b/ext/standard/pack.c index cce7913a9a..750bec3a4d 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -642,7 +642,7 @@ PHP_FUNCTION(unpack) /* Space for name + number, safe as namelen is ensured <= 200 */ char n[256]; - if (arg != 1) { + if (arg != 1 || namelen == 0) { /* Need to add element number to name */ sprintf(n, "%.*s%d", namelen, name, i + 1); } else {