author | Rich Felker <dalias@aerifal.cx> | 2018年11月08日 15:00:02 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018年11月08日 15:22:22 -0500 |
commit | 122d67f846cb0be2c9e1c3880db9eb9545bbe38c (patch) | |
tree | a219e7810b20690c12a6ab14e47f9c57b03ac7b9 | |
parent | 04e18b61dfde85e34ddea15e4a7d49f24c47bb73 (diff) | |
download | musl-122d67f846cb0be2c9e1c3880db9eb9545bbe38c.tar.gz |
-rw-r--r-- | src/string/memmem.c | 2 | ||||
-rw-r--r-- | src/string/strstr.c | 2 |
diff --git a/src/string/memmem.c b/src/string/memmem.c index ce3cd190..58a21fcd 100644 --- a/src/string/memmem.c +++ b/src/string/memmem.c @@ -100,7 +100,7 @@ static char *twoway_memmem(const unsigned char *h, const unsigned char *z, const if (BITOP(byteset, h[l-1], &)) { k = l-shift[h[l-1]]; if (k) { - if (mem && k < p) k = l-p; + if (k < mem) k = mem; h += k; mem = 0; continue; diff --git a/src/string/strstr.c b/src/string/strstr.c index c7d66682..55ba1c7b 100644 --- a/src/string/strstr.c +++ b/src/string/strstr.c @@ -109,7 +109,7 @@ static char *twoway_strstr(const unsigned char *h, const unsigned char *n) if (BITOP(byteset, h[l-1], &)) { k = l-shift[h[l-1]]; if (k) { - if (mem && k < p) k = l-p; + if (k < mem) k = mem; h += k; mem = 0; continue; |