cvsuser 04/06/12 06:19:22
Modified: src string.c
Log:
Fix bug #30220 - off by one in string_unescape_cstring
Revision Changes Path
1.205 +6 -4 parrot/src/string.c
Index: string.c
===================================================================
RCS file: /cvs/public/parrot/src/string.c,v
retrieving revision 1.204
retrieving revision 1.205
diff -u -w -r1.204 -r1.205
--- string.c 31 May 2004 20:38:56 -0000 1.204
+++ string.c 12 Jun 2004 13:19:22 -0000 1.205
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: string.c,v 1.204 2004/05/31 20:38:56 sfink Exp $
+$Id: string.c,v 1.205 2004/06/12 13:19:22 nicholas Exp $
=head1 NAME
@@ -3003,10 +3003,12 @@
char_at = set_char_getter(result);
set_char_at = set_char_setter(result);
- for (offs = d = 0; ; ++offs) {
+ for (offs = d = 0; offs < clength; ++offs) {
r = (char_at)(offs, result);
- if (!r || r == (Parrot_UInt4)delimiter)
- break;
+ /* There cannot be any NULs within this string. */
+ assert(r != '\0');
+ /* It's also a logic bug if we encounter the delimiter. */
+ assert(r != (Parrot_UInt4)delimiter);
if (r == '\\') {
++offs;
r = string_unescape_one(char_at, &offs, result->strlen, result);