1e19d46c8SRobert Clausecker /*-
2e19d46c8SRobert Clausecker * Copyright (c) 2023 The FreeBSD Foundation
3e19d46c8SRobert Clausecker *
4e19d46c8SRobert Clausecker * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
5e19d46c8SRobert Clausecker * under sponsorship from the FreeBSD Foundation.
6e19d46c8SRobert Clausecker *
7e19d46c8SRobert Clausecker * Redistribution and use in source and binary forms, with or without
8e19d46c8SRobert Clausecker * modification, are permitted provided that the following conditions
9e19d46c8SRobert Clausecker * are met:
10e19d46c8SRobert Clausecker * 1. Redistributions of source code must retain the above copyright
11e19d46c8SRobert Clausecker * notice, this list of conditions and the following disclaimer.
12e19d46c8SRobert Clausecker * 2. Redistributions in binary form must reproduce the above copyright
13e19d46c8SRobert Clausecker * notice, this list of conditions and the following disclaimer in the
14e19d46c8SRobert Clausecker * documentation and/or other materials provided with the distribution.
15e19d46c8SRobert Clausecker *
16e19d46c8SRobert Clausecker * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ''AS IS'' AND
17e19d46c8SRobert Clausecker * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18e19d46c8SRobert Clausecker * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19e19d46c8SRobert Clausecker * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20e19d46c8SRobert Clausecker * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21e19d46c8SRobert Clausecker * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22e19d46c8SRobert Clausecker * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23e19d46c8SRobert Clausecker * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24e19d46c8SRobert Clausecker * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25e19d46c8SRobert Clausecker * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26e19d46c8SRobert Clausecker * SUCH DAMAGE
27e19d46c8SRobert Clausecker */
28e19d46c8SRobert Clausecker
29e19d46c8SRobert Clausecker #include <sys/cdefs.h>
30e19d46c8SRobert Clausecker #include <string.h>
31e19d46c8SRobert Clausecker
32*e5551250SKyle Evans #undef strncpy /* _FORTIFY_SOURCE */
33*e5551250SKyle Evans
34e19d46c8SRobert Clausecker char *__stpncpy(char *restrict, const char *restrict, size_t);
35e19d46c8SRobert Clausecker
36e19d46c8SRobert Clausecker char *
strncpy(char * restrict dst,const char * restrict src,size_t len)37e19d46c8SRobert Clausecker strncpy(char *restrict dst, const char *restrict src, size_t len)
38e19d46c8SRobert Clausecker {
39e19d46c8SRobert Clausecker
40e19d46c8SRobert Clausecker __stpncpy(dst, src, len);
41e19d46c8SRobert Clausecker
42e19d46c8SRobert Clausecker return (dst);
43e19d46c8SRobert Clausecker }
44