summaryrefslogtreecommitdiff
path: root/lib/libc/string/strstr.c
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2020-11-19 00:03:15 +0000
committerEd Maste <emaste@FreeBSD.org>2020-11-19 00:03:15 +0000
commit33482dae89c26158a22ccb3b7f2ca6e6652f29b4 (patch)
treefd3b51ccf64a221252b5239b3de5ecad7a1888b5 /lib/libc/string/strstr.c
parent7dbcd06e63101d51e6a777f7315cfde794411e53 (diff)
Notes
Diffstat (limited to 'lib/libc/string/strstr.c')
-rw-r--r--lib/libc/string/strstr.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/string/strstr.c b/lib/libc/string/strstr.c
index d726aff1f1c3..72f8abb9e200 100644
--- a/lib/libc/string/strstr.c
+++ b/lib/libc/string/strstr.c
@@ -40,8 +40,8 @@ twobyte_strstr(const unsigned char *h, const unsigned char *n)
static char *
threebyte_strstr(const unsigned char *h, const unsigned char *n)
{
- uint32_t nw = n[0] << 24 | n[1] << 16 | n[2] << 8;
- uint32_t hw = h[0] << 24 | h[1] << 16 | h[2] << 8;
+ uint32_t nw = (uint32_t)n[0] << 24 | n[1] << 16 | n[2] << 8;
+ uint32_t hw = (uint32_t)h[0] << 24 | h[1] << 16 | h[2] << 8;
for (h += 2; *h && hw != nw; hw = (hw | *++h) << 8)
;
return *h ? (char *)h - 2 : 0;
@@ -50,8 +50,8 @@ threebyte_strstr(const unsigned char *h, const unsigned char *n)
static char *
fourbyte_strstr(const unsigned char *h, const unsigned char *n)
{
- uint32_t nw = n[0] << 24 | n[1] << 16 | n[2] << 8 | n[3];
- uint32_t hw = h[0] << 24 | h[1] << 16 | h[2] << 8 | h[3];
+ uint32_t nw = (uint32_t)n[0] << 24 | n[1] << 16 | n[2] << 8 | n[3];
+ uint32_t hw = (uint32_t)h[0] << 24 | h[1] << 16 | h[2] << 8 | h[3];
for (h += 3; *h && hw != nw; hw = hw << 8 | *++h)
;
return *h ? (char *)h - 3 : 0;