aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/string/str-two-way.h
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2008-10-02 20:12:34 +0000
committerJeff Johnston <jjohnstn@redhat.com>2008-10-02 20:12:34 +0000
commit015b86d725e33a221b89d93cbd0700980c7b75bf (patch)
tree10f2610447b6420a52137170a82e1e2ce7a52bc8 /newlib/libc/string/str-two-way.h
parenteea95bd1439db6ef98d12b4bb04fb7598f6296bf (diff)
downloadnewlib-015b86d725e33a221b89d93cbd0700980c7b75bf.zip
newlib-015b86d725e33a221b89d93cbd0700980c7b75bf.tar.gz
newlib-015b86d725e33a221b89d93cbd0700980c7b75bf.tar.bz2
2008-10-02 Jeff Johnston <jjohnstn@redhat.com>
* libc/string/str-two-way.h (critical_factorization): Cast the index operation to ensure unsigned rollover occurs when adding to SIZE_MAX.
Diffstat (limited to 'newlib/libc/string/str-two-way.h')
-rw-r--r--newlib/libc/string/str-two-way.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/newlib/libc/string/str-two-way.h b/newlib/libc/string/str-two-way.h
index ad71a25..72b60c3 100644
--- a/newlib/libc/string/str-two-way.h
+++ b/newlib/libc/string/str-two-way.h
@@ -114,7 +114,7 @@ critical_factorization (const unsigned char *needle, size_t needle_len,
while (j + k < needle_len)
{
a = CANON_ELEMENT (needle[j + k]);
- b = CANON_ELEMENT (needle[max_suffix + k]);
+ b = CANON_ELEMENT (needle[(size_t)(max_suffix + k)]);
if (a < b)
{
/* Suffix is smaller, period is entire prefix so far. */