This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
47109bf
)
Re: static buffer in not_a_number() [sv.c] might overflow
author
Gisle Aas
<aas@bergen.sn.no>
Sun, 9 Feb 1997 10:55:41 +0000
(11:55 +0100)
committer
Chip Salzenberg
<chip@atlantic.net>
Mon, 10 Feb 1997 19:29:00 +0000
(07:29 +1200)
p5p-msgid: <hbu9uz1si.fsf@bergen.sn.no>
sv.c
patch
|
blob
|
blame
|
history
diff --git
a/sv.c
b/sv.c
index
5adbe8a
..
528afd9
100644
(file)
--- a/
sv.c
+++ b/
sv.c
@@
-1195,9
+1195,11
@@
SV *sv;
char tmpbuf[64];
char *d = tmpbuf;
char *s;
- int i;
+ char *limit = tmpbuf + sizeof(tmpbuf) - 8;
+ /* each *s can expand to 4 chars + "...\0",
+ i.e. need room for 8 chars */
- for (s = SvPVX(sv)
, i = 50; *s && i; s++,i--
) {
+ for (s = SvPVX(sv)
; *s && d < limit; s++
) {
int ch = *s & 0xFF;
if (ch & 128 && !isPRINT_LC(ch)) {
*d++ = 'M';