@@ -214,51 +214,6 @@ __kernel_size_t __fortify_strlen(const char * const POS p)
214
214
return ret ;
215
215
}
216
216
217
- /* Defined after fortified strlen() to reuse it. */
218
- extern size_t __real_strlcpy (char * , const char * , size_t ) __RENAME (strlcpy );
219
- /**
220
- * strlcpy - Copy a string into another string buffer
221
- *
222
- * @p: pointer to destination of copy
223
- * @q: pointer to NUL-terminated source string to copy
224
- * @size: maximum number of bytes to write at @p
225
- *
226
- * If strlen(@q) >= @size, the copy of @q will be truncated at
227
- * @size - 1 bytes. @p will always be NUL-terminated.
228
- *
229
- * Do not use this function. While FORTIFY_SOURCE tries to avoid
230
- * over-reads when calculating strlen(@q), it is still possible.
231
- * Prefer strscpy(), though note its different return values for
232
- * detecting truncation.
233
- *
234
- * Returns total number of bytes written to @p, including terminating NUL.
235
- *
236
- */
237
- __FORTIFY_INLINE size_t strlcpy (char * const POS p , const char * const POS q , size_t size )
238
- {
239
- const size_t p_size = __member_size (p );
240
- const size_t q_size = __member_size (q );
241
- size_t q_len ; /* Full count of source string length. */
242
- size_t len ; /* Count of characters going into destination. */
243
-
244
- if (p_size == SIZE_MAX && q_size == SIZE_MAX )
245
- return __real_strlcpy (p , q , size );
246
- q_len = strlen (q );
247
- len = (q_len >= size ) ? size - 1 : q_len ;
248
- if (__builtin_constant_p (size ) && __builtin_constant_p (q_len ) && size ) {
249
- /* Write size is always larger than destination. */
250
- if (len >= p_size )
251
- __write_overflow ();
252
- }
253
- if (size ) {
254
- if (len >= p_size )
255
- fortify_panic (__func__ );
256
- __underlying_memcpy (p , q , len );
257
- p [len ] = '\0' ;
258
- }
259
- return q_len ;
260
- }
261
-
262
217
/* Defined after fortified strnlen() to reuse it. */
263
218
extern ssize_t __real_strscpy (char * , const char * , size_t ) __RENAME (strscpy );
264
219
/**
@@ -272,12 +227,6 @@ extern ssize_t __real_strscpy(char *, const char *, size_t) __RENAME(strscpy);
272
227
* @p buffer. The behavior is undefined if the string buffers overlap. The
273
228
* destination @p buffer is always NUL terminated, unless it's zero-sized.
274
229
*
275
- * Preferred to strlcpy() since the API doesn't require reading memory
276
- * from the source @q string beyond the specified @size bytes, and since
277
- * the return value is easier to error-check than strlcpy()'s.
278
- * In addition, the implementation is robust to the string changing out
279
- * from underneath it, unlike the current strlcpy() implementation.
280
- *
281
230
* Preferred to strncpy() since it always returns a valid string, and
282
231
* doesn't unnecessarily force the tail of the destination buffer to be
283
232
* zero padded. If padding is desired please use strscpy_pad().
0 commit comments