diff options
author | wtc%netscape.com <devnull@localhost> | 2003-01-14 02:08:09 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2003-01-14 02:08:09 +0000 |
commit | 5492bfdf5b1d4b2c7f16fcc53925c6cb1ae1f03f (patch) | |
tree | c9d971715a75346851ce00f5c7f839a918c5a121 | |
parent | c5d1373dcaa949b8ea0b37ac15956992f39f0cd7 (diff) | |
download | nspr-hg-5492bfdf5b1d4b2c7f16fcc53925c6cb1ae1f03f.tar.gz |
Bug 188976: avoid calculating the difference of two unsigned integer if
the difference is really a negative number. Thanks to Rick Swift for the
patch.
Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
-rw-r--r-- | lib/libc/src/strstr.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/src/strstr.c b/lib/libc/src/strstr.c index 3f38a34f..fe658c1b 100644 --- a/lib/libc/src/strstr.c +++ b/lib/libc/src/strstr.c @@ -57,13 +57,15 @@ PL_strrstr(const char *big, const char *little) { const char *p; PRUint32 ll; + PRUint32 bl; if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0; if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0; ll = PL_strlen(little); - p = &big[ PL_strlen(big) - ll ]; - if( p < big ) return (char *)0; + bl = PL_strlen(big); + if( bl < ll ) return (char *)0; + p = &big[ bl - ll ]; for( ; p >= big; p-- ) if( *little == *p ) |