summaryrefslogtreecommitdiff
path: root/include/string.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/string.h')
-rw-r--r--include/string.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/string.h b/include/string.h
index dc7cc19..7a8564a 100644
--- a/include/string.h
+++ b/include/string.h
@@ -213,9 +213,10 @@ _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s,
213#if __has_builtin(__builtin___stpncpy_chk) && defined(FORTIFY_USE_NATIVE_CHK) 213#if __has_builtin(__builtin___stpncpy_chk) && defined(FORTIFY_USE_NATIVE_CHK)
214 return __builtin___stpncpy_chk(__d, __s, __n, __fh_bos(__d, 0)); 214 return __builtin___stpncpy_chk(__d, __s, __n, __fh_bos(__d, 0));
215#else 215#else
216 // If the length strlen(src) is smaller than n, the remaining 216 /* If the length strlen(src) is smaller than n, the remaining
217 // characters in the array pointed to by dest are filled with null 217 * characters in the array pointed to by dest are filled with null
218 // bytes ('\0') 218 * bytes ('\0')
219 */
219 __fh_size_t __b = __fh_bos(__d, 0); 220 __fh_size_t __b = __fh_bos(__d, 0);
220 if (__n > __b) 221 if (__n > __b)
221 __builtin_trap(); 222 __builtin_trap();
@@ -292,7 +293,7 @@ _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s,
292#if __has_builtin(__builtin___strncat_chk) && defined(FORTIFY_USE_NATIVE_CHK) 293#if __has_builtin(__builtin___strncat_chk) && defined(FORTIFY_USE_NATIVE_CHK)
293 return __builtin___strncat_chk(__d, __s, __n, __fh_bos(__d, 0)); 294 return __builtin___strncat_chk(__d, __s, __n, __fh_bos(__d, 0));
294#else 295#else
295#if 0 // strlen(__s) isn't guaranteed to be valid. 296#if 0 /* strlen(__s) isn't guaranteed to be valid. */
296 __fh_size_t __b = __fh_bos(__d, 0); 297 __fh_size_t __b = __fh_bos(__d, 0);
297 298
298 if (__n > __b) { 299 if (__n > __b) {
@@ -319,8 +320,9 @@ _FORTIFY_FN(strncpy) char *strncpy(char * _FORTIFY_POS0 __d,
319#if __has_builtin(__builtin___strncpy_chk) && defined(FORTIFY_USE_NATIVE_CHK) 320#if __has_builtin(__builtin___strncpy_chk) && defined(FORTIFY_USE_NATIVE_CHK)
320 return __builtin___strncpy_chk(__d, __s, __n, __fh_bos(__d, 0)); 321 return __builtin___strncpy_chk(__d, __s, __n, __fh_bos(__d, 0));
321#else 322#else
322 // If the length of src is less than n, strncpy() writes additional 323 /* If the length of src is less than n, strncpy() writes additional
323 // null bytes to dest to ensure that a total of n bytes are written. 324 * null bytes to dest to ensure that a total of n bytes are written.
325 */
324 __fh_size_t __b = __fh_bos(__d, 0); 326 __fh_size_t __b = __fh_bos(__d, 0);
325 if (__n > __b) 327 if (__n > __b)
326 __builtin_trap(); 328 __builtin_trap();