From e1505662ad8d838bd0347e7f26ce01dbc3ccb476 Mon Sep 17 00:00:00 2001 From: foobar Date: Wed, 25 Feb 2004 12:36:24 +0000 Subject: [PATCH] MFH: Fixed bug #27384 (unpack() misbehaves with 1 char string). (GeorgeS) --- NEWS | 1 + ext/standard/pack.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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 { -- 2.50.1