Deleted Added
full compact
fgets.3 (189136) fgets.3 (208027)
1.\" Copyright (c) 1990, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek and the American National Standards Committee X3,
6.\" on Information Processing Systems.
7.\"
8.\" Redistribution and use in source and binary forms, with or without

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)fgets.3 8.1 (Berkeley) 6/4/93
1.\" Copyright (c) 1990, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek and the American National Standards Committee X3,
6.\" on Information Processing Systems.
7.\"
8.\" Redistribution and use in source and binary forms, with or without

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)fgets.3 8.1 (Berkeley) 6/4/93
33.\" $FreeBSD: head/lib/libc/stdio/fgets.3 189136 2009-02-28 06:00:58Z das $
33.\" $FreeBSD: head/lib/libc/stdio/fgets.3 208027 2010-05-13 12:07:55Z uqs $
34.\"
35.Dd June 4, 1993
36.Dt FGETS 3
37.Os
38.Sh NAME
39.Nm fgets ,
40.Nm gets
41.Nd get a line from a stream

--- 81 unchanged lines hidden (view full) ---

123.Xr malloc 3 .
124.Pp
125The function
126.Fn gets
127may also fail and set
128.Va errno
129for any of the errors specified for the routine
130.Xr getchar 3 .
34.\"
35.Dd June 4, 1993
36.Dt FGETS 3
37.Os
38.Sh NAME
39.Nm fgets ,
40.Nm gets
41.Nd get a line from a stream

--- 81 unchanged lines hidden (view full) ---

123.Xr malloc 3 .
124.Pp
125The function
126.Fn gets
127may also fail and set
128.Va errno
129for any of the errors specified for the routine
130.Xr getchar 3 .
131.Sh SEE ALSO
132.Xr feof 3 ,
133.Xr ferror 3 ,
134.Xr fgetln 3 ,
135.Xr fgetws 3 ,
136.Xr getline 3
137.Sh STANDARDS
138The functions
139.Fn fgets
140and
141.Fn gets
142conform to
143.St -isoC-99 .
131.Sh SECURITY CONSIDERATIONS
132The
133.Fn gets
134function cannot be used securely.
135Because of its lack of bounds checking,
136and the inability for the calling program
137to reliably determine the length of the next incoming line,
138the use of this function enables malicious users
139to arbitrarily change a running program's functionality through
140a buffer overflow attack.
141It is strongly suggested that the
142.Fn fgets
143function be used in all cases.
144(See
145the FSA.)
144.Sh SECURITY CONSIDERATIONS
145The
146.Fn gets
147function cannot be used securely.
148Because of its lack of bounds checking,
149and the inability for the calling program
150to reliably determine the length of the next incoming line,
151the use of this function enables malicious users
152to arbitrarily change a running program's functionality through
153a buffer overflow attack.
154It is strongly suggested that the
155.Fn fgets
156function be used in all cases.
157(See
158the FSA.)
146.Sh SEE ALSO
147.Xr feof 3 ,
148.Xr ferror 3 ,
149.Xr fgetln 3 ,
150.Xr fgetws 3 ,
151.Xr getline 3
152.Sh STANDARDS
153The functions
154.Fn fgets
155and
156.Fn gets
157conform to
158.St -isoC-99 .