summaryrefslogtreecommitdiff
path: root/include/string.h
diff options
context:
space:
mode:
authorjvoisin2024-09-02 16:08:38 +0200
committerjvoisin2024-09-02 16:11:06 +0200
commit114b563adc2b942bc5abd4c5820507076d453f64 (patch)
tree6dea462ef43cba56be35d884f98d9e450f78d232 /include/string.h
parentc4d9299abf7f6b941493fc487d2ccbb47d756479 (diff)
Revert d2594298b89d0fb8989cae3ebc8900e77b6aa478
As reported on irc: ``` 17:51 <q> jvoisin, fortify-headers seems to be broken (on Alpine at least) 17:52 <q> Repeating the message from over-there: 17:52 <q> /usr/include/fortify/string.h: In function 'strncat': 17:52 <q> /usr/include/fortify/string.h:297:36: error: implicit declaration of function 'strnlen'; did you mean 'strlen'? [-Wimplicit-function-declaration] 17:52 <q> This is with a simple file that includes string.h and call strncat, built with c99 -O1 f.c ```
Diffstat (limited to 'include/string.h')
-rw-r--r--include/string.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/string.h b/include/string.h
index 10d071a..c1c24bc 100644
--- a/include/string.h
+++ b/include/string.h
@@ -208,7 +208,9 @@ _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s,
208#if __has_builtin(__builtin___stpncpy_chk) && FORTIFY_USE_NATIVE_CHK 208#if __has_builtin(__builtin___stpncpy_chk) && FORTIFY_USE_NATIVE_CHK
209 return __builtin___stpncpy_chk(__d, __s, __n, __fh_bos(__d, 0)); 209 return __builtin___stpncpy_chk(__d, __s, __n, __fh_bos(__d, 0));
210#else 210#else
211 __fh_size_t max_len_s = strnlen(__s, __n); 211 __fh_size_t max_len_s = strlen(__s);
212 if (max_len_s > __n)
213 max_len_s = __n;
212 if (__fh_overlap(__d, max_len_s, __s, max_len_s)) 214 if (__fh_overlap(__d, max_len_s, __s, max_len_s))
213 __builtin_trap(); 215 __builtin_trap();
214 216