summaryrefslogtreecommitdiff
path: root/pp_pack.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-09-24 16:09:37 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-09-24 16:09:37 +0000
commitd50dd4e4eaf05f186e67ce979ed880c59f1a81bc (patch)
tree4743b00ba1c2c033381bb6844ff9f96a1bd8b9aa /pp_pack.c
parent65486cd120c0733b920597ede1ed5a6c26c798d8 (diff)
downloadperl-d50dd4e4eaf05f186e67ce979ed880c59f1a81bc.tar.gz
unpack("Z*Z*", pack("Z*Z*", ..)) bug, patch and test from
Wolfgang Laun <Wolfgang.Laun@alcatel.at> p4raw-id: //depot/perl@12180
Diffstat (limited to 'pp_pack.c')
-rw-r--r--pp_pack.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pp_pack.c b/pp_pack.c
index ff2f8e0ee8..021c35c737 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -266,13 +266,14 @@ PP(pp_unpack)
goto uchar_checksum;
sv = NEWSV(35, len);
sv_setpvn(sv, s, len);
- s += len;
if (datumtype == 'A' || datumtype == 'Z') {
aptr = s; /* borrow register */
if (datumtype == 'Z') { /* 'Z' strips stuff after first null */
s = SvPVX(sv);
while (*s)
s++;
+ if (star) /* exact for 'Z*' */
+ len = s - SvPVX(sv) + 1;
}
else { /* 'A' strips both nulls and spaces */
s = SvPVX(sv) + len - 1;
@@ -283,6 +284,7 @@ PP(pp_unpack)
SvCUR_set(sv, s - SvPVX(sv));
s = aptr; /* unborrow register */
}
+ s += len;
XPUSHs(sv_2mortal(sv));
break;
case 'B':