summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/strstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/string/strstr.c')
-rw-r--r--src/lib/libc/string/strstr.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libc/string/strstr.c b/src/lib/libc/string/strstr.c
index 241a080e7a..06795d9838 100644
--- a/src/lib/libc/string/strstr.c
+++ b/src/lib/libc/string/strstr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strstr.c,v 1.9 2020/04/16 12:37:52 claudio Exp $ */ 1/* $OpenBSD: strstr.c,v 1.10 2026/06/23 13:09:11 tim Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2005-2018 Rich Felker 4 * Copyright (c) 2005-2018 Rich Felker
@@ -37,8 +37,8 @@ twobyte_strstr(const unsigned char *h, const unsigned char *n)
37static char * 37static char *
38threebyte_strstr(const unsigned char *h, const unsigned char *n) 38threebyte_strstr(const unsigned char *h, const unsigned char *n)
39{ 39{
40 uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8; 40 uint32_t nw = (uint32_t)n[0]<<24 | n[1]<<16 | n[2]<<8;
41 uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8; 41 uint32_t hw = (uint32_t)h[0]<<24 | h[1]<<16 | h[2]<<8;
42 for (h+=2; *h && hw != nw; hw = (hw|*++h)<<8); 42 for (h+=2; *h && hw != nw; hw = (hw|*++h)<<8);
43 return *h ? (char *)h-2 : 0; 43 return *h ? (char *)h-2 : 0;
44} 44}
@@ -46,8 +46,8 @@ threebyte_strstr(const unsigned char *h, const unsigned char *n)
46static char * 46static char *
47fourbyte_strstr(const unsigned char *h, const unsigned char *n) 47fourbyte_strstr(const unsigned char *h, const unsigned char *n)
48{ 48{
49 uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3]; 49 uint32_t nw = (uint32_t)n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3];
50 uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3]; 50 uint32_t hw = (uint32_t)h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3];
51 for (h+=3; *h && hw != nw; hw = hw<<8 | *++h); 51 for (h+=3; *h && hw != nw; hw = hw<<8 | *++h);
52 return *h ? (char *)h-3 : 0; 52 return *h ? (char *)h-3 : 0;
53} 53}