summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorDavid Dyck <david.dyck@fluke.com>2001-04-04 06:27:15 -0700
committerJarkko Hietaniemi <jhi@iki.fi>2001-04-05 22:23:06 +0000
commit6f894eade1cb03fcc18e4faa9e39f693bad68f34 (patch)
treed51374c605b9512b3aa9179ed1984445fdf9d5fb /pp.c
parent793e2a70013bc23954e40bce02eca6d093caef68 (diff)
downloadperl-6f894eade1cb03fcc18e4faa9e39f693bad68f34.tar.gz
bleadperl / hex ignores variable length and/or tr doesn't null terminate ( with patch)
Message-ID: <Pine.LNX.4.30.0104041325310.25358-100000@dd.tc.fluke.com> p4raw-id: //depot/perl@9573
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/pp.c b/pp.c
index fde8473b2c..9d96b944f5 100644
--- a/pp.c
+++ b/pp.c
@@ -2667,11 +2667,11 @@ PP(pp_hex)
dSP; dTARGET;
char *tmps;
STRLEN argtype;
- STRLEN n_a;
+ STRLEN len;
- tmps = POPpx;
+ tmps = (SvPVx(POPs, len));
argtype = 1; /* allow underscores */
- XPUSHn(scan_hex(tmps, 99, &argtype));
+ XPUSHn(scan_hex(tmps, len, &argtype));
RETURN;
}
@@ -2681,20 +2681,20 @@ PP(pp_oct)
NV value;
STRLEN argtype;
char *tmps;
- STRLEN n_a;
+ STRLEN len;
- tmps = POPpx;
- while (*tmps && isSPACE(*tmps))
- tmps++;
+ tmps = (SvPVx(POPs, len));
+ while (*tmps && len && isSPACE(*tmps))
+ tmps++, len--;
if (*tmps == '0')
- tmps++;
+ tmps++, len--;
argtype = 1; /* allow underscores */
if (*tmps == 'x')
- value = scan_hex(++tmps, 99, &argtype);
+ value = scan_hex(++tmps, --len, &argtype);
else if (*tmps == 'b')
- value = scan_bin(++tmps, 99, &argtype);
+ value = scan_bin(++tmps, --len, &argtype);
else
- value = scan_oct(tmps, 99, &argtype);
+ value = scan_oct(tmps, len, &argtype);
XPUSHn(value);
RETURN;
}