public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Fix off-by-one errors
@ 2004-02-06 15:21 Andreas Schwab
  2004-02-06 18:30 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2004-02-06 15:21 UTC (permalink / raw)
  To: libc-hacker

regcomp is accessing arrays outside their bounds.

Andreas.

2004-02-06  Andreas Schwab  <schwab@suse.de>

	* posix/regcomp.c (build_range_exp): Fix off-by-one.
	(parse_bracket_exp): Likewise.

Index: posix/regcomp.c
===================================================================
RCS file: /cvs/glibc/libc/posix/regcomp.c,v
retrieving revision 1.77
diff -u -p -a -u -p -a -r1.77 posix/regcomp.c
--- posix/regcomp.c	30 Jan 2004 05:19:45 -0000	1.77
+++ posix/regcomp.c	6 Feb 2004 15:04:44 -0000
@@ -2603,7 +2603,7 @@ build_range_exp (sbcset, start_elem, end
       }
 
     /* Build the table for single byte characters.  */
-    for (wc = 0; wc <= SBC_MAX; ++wc)
+    for (wc = 0; wc < SBC_MAX; ++wc)
       {
 	cmp_buf[2] = wc;
 	if (wcscoll (cmp_buf, cmp_buf + 2) <= 0
@@ -2623,7 +2623,7 @@ build_range_exp (sbcset, start_elem, end
     if (start_ch > end_ch)
       return REG_ERANGE;
     /* Build the table for single byte characters.  */
-    for (ch = 0; ch <= SBC_MAX; ++ch)
+    for (ch = 0; ch < SBC_MAX; ++ch)
       if (start_ch <= ch  && ch <= end_ch)
 	bitset_set (sbcset, ch);
   }
@@ -2846,7 +2846,7 @@ parse_bracket_exp (regexp, dfa, token, s
 	}
 
       /* Build the table for single byte characters.  */
-      for (ch = 0; ch <= SBC_MAX; ch++)
+      for (ch = 0; ch < SBC_MAX; ch++)
 	{
 	  uint32_t ch_collseq;
 	  /*

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix off-by-one errors
  2004-02-06 15:21 Fix off-by-one errors Andreas Schwab
@ 2004-02-06 18:30 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2004-02-06 18:30 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Schwab wrote:
> regcomp is accessing arrays outside their bounds.

Applied, thanks.

- -- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAI90s2ijCOnn/RHQRAqPtAJ92t5F5MblTYRz+Wwxyvepx/+geGgCdF7Aj
RavDEHWZ45AED0smIYI0Czg=
=GePJ
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-02-06 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-06 15:21 Fix off-by-one errors Andreas Schwab
2004-02-06 18:30 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).