summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorjvoisin2023-09-20 17:00:11 +0200
committerjvoisin2023-09-20 17:00:11 +0200
commitd2594298b89d0fb8989cae3ebc8900e77b6aa478 (patch)
treec16df80583c40de2ed8c41804ae087f7cdd1412c /include
parentd2ab22e80e192f6013f7fa83a6b28864bd5865e4 (diff)
Replace a strlen+condition with strnlen
Diffstat (limited to 'include')
-rw-r--r--include/string.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/include/string.h b/include/string.h
index 0a9cd07..be13cb4 100644
--- a/include/string.h
+++ b/include/string.h
@@ -191,9 +191,7 @@ _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s,
191 size_t __b = __bos(__d, 0); 191 size_t __b = __bos(__d, 0);
192 192
193 if (__n > __b) { 193 if (__n > __b) {
194 size_t __sl = strlen(__s); 194 size_t __sl = strnlen(__s, __n);
195 if (__sl > __n)
196 __sl = __n;
197 size_t __dl = strlen(__d); 195 size_t __dl = strlen(__d);
198 if (__sl + __dl + 1 > __b) 196 if (__sl + __dl + 1 > __b)
199 __builtin_trap(); 197 __builtin_trap();