projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix inadvertent use of uninitialized variable in dladdr
[musl]
/
src
/
string
/
strstr.c
diff --git
a/src/string/strstr.c
b/src/string/strstr.c
index
915c0a2
..
55ba1c7
100644
(file)
--- a/
src/string/strstr.c
+++ b/
src/string/strstr.c
@@
-108,9
+108,8
@@
static char *twoway_strstr(const unsigned char *h, const unsigned char *n)
/* Check last byte first; advance by shift on mismatch */
if (BITOP(byteset, h[l-1], &)) {
k = l-shift[h[l-1]];
/* Check last byte first; advance by shift on mismatch */
if (BITOP(byteset, h[l-1], &)) {
k = l-shift[h[l-1]];
- //printf("adv by %zu (on %c) at [%s] (%zu;l=%zu)\n", k, h[l-1], h, shift[h[l-1]], l);
if (k) {
if (k) {
- if (
mem0 && mem && k < p) k = l-p
;
+ if (
k < mem) k = mem
;
h += k;
mem = 0;
continue;
h += k;
mem = 0;
continue;
@@
-130,7
+129,7
@@
static char *twoway_strstr(const unsigned char *h, const unsigned char *n)
}
/* Compare left half */
for (k=ms+1; k>mem && n[k-1] == h[k-1]; k--);
}
/* Compare left half */
for (k=ms+1; k>mem && n[k-1] == h[k-1]; k--);
- if (k
=
= mem) return (char *)h;
+ if (k
<
= mem) return (char *)h;
h += p;
mem = mem0;
}
h += p;
mem = mem0;
}