]> git.saurik.com Git - apple/libc.git/blob - string/FreeBSD/strcat.3.patch
Libc-594.1.4.tar.gz
[apple/libc.git] / string / FreeBSD / strcat.3.patch
1 --- strcat.3.orig 2008-02-29 10:45:51.000000000 -0800
2 +++ strcat.3 2008-02-29 12:07:09.000000000 -0800
3 @@ -40,16 +40,24 @@
4 .Dt STRCAT 3
5 .Os
6 .Sh NAME
7 -.Nm strcat
8 +.Nm strcat ,
9 +.Nm strncat
10 .Nd concatenate strings
11 .Sh LIBRARY
12 .Lb libc
13 .Sh SYNOPSIS
14 .In string.h
15 .Ft char *
16 -.Fn strcat "char * restrict s" "const char * restrict append"
17 +.Fo strcat
18 +.Fa "char *restrict s1"
19 +.Fa "const char *restrict s2"
20 +.Fc
21 .Ft char *
22 -.Fn strncat "char * restrict s" "const char * restrict append" "size_t count"
23 +.Fo strncat
24 +.Fa "char *restrict s1"
25 +.Fa "const char *restrict s2"
26 +.Fa "size_t n"
27 +.Fc
28 .Sh DESCRIPTION
29 The
30 .Fn strcat
31 @@ -57,24 +65,27 @@
32 .Fn strncat
33 functions
34 append a copy of the null-terminated string
35 -.Fa append
36 +.Fa s2
37 to the end of the null-terminated string
38 -.Fa s ,
39 +.Fa s1 ,
40 then add a terminating
41 .Ql \e0 .
42 The string
43 -.Fa s
44 +.Fa s1
45 must have sufficient space to hold the result.
46 .Pp
47 The
48 .Fn strncat
49 function
50 appends not more than
51 -.Fa count
52 +.Fa n
53 characters from
54 -.Fa append ,
55 +.Fa s2 ,
56 and then adds a terminating
57 .Ql \e0 .
58 +.Pp
59 +The source and destination strings should not overlap, as the
60 +behavior is undefined.
61 .Sh RETURN VALUES
62 The
63 .Fn strcat
64 @@ -82,7 +93,7 @@
65 .Fn strncat
66 functions
67 return the pointer
68 -.Fa s .
69 +.Fa s1 .
70 .Sh SECURITY CONSIDERATIONS
71 The
72 .Fn strcat
73 @@ -114,7 +125,7 @@
74 void
75 foo(const char *arbitrary_string)
76 {
77 - char onstack[8];
78 + char onstack[8] = "";
79
80 #if defined(BAD)
81 /*
82 @@ -149,11 +160,6 @@
83 .Xr strcpy 3 ,
84 .Xr strlcat 3 ,
85 .Xr strlcpy 3
86 -.Rs
87 -.%T "The FreeBSD Security Architecture"
88 -.Re
89 -(See
90 -.Pa "/usr/share/doc/{to be decided}" . )
91 .Sh STANDARDS
92 The
93 .Fn strcat