aboutsummaryrefslogtreecommitdiffstats
path: root/man/man3/gets.3
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2024-04-26 15:06:49 +0200
committerAlejandro Colomar <alx@kernel.org>2024-05-02 01:24:19 +0200
commitdcde2f70372b49ec43efc5db864c9ff585d0a2dd (patch)
tree78b9b7425130e4a5858e4c01a524d802423879ed /man/man3/gets.3
parent12aca537ce78a41bbcdaf485209691e10f8002d7 (diff)
downloadman-pages-dcde2f70372b49ec43efc5db864c9ff585d0a2dd.tar.gz
man/, share/mk/: Move man*/ to man/
This is a scripted change: $ mkdir man/; $ mv man* man/; $ ln -st . man/man*; $ find share/mk/ -type f \ | xargs grep -l '^MANDIR *:=' \ | xargs sed -i '/^MANDIR *:=/s,$,/man,'; $ find share/mk/dist/ -type f \ | xargs grep -l man \ | xargs sed -i 's,man%,man/%,g'; Link: <https://lore.kernel.org/linux-man/YxcV4h+Xn7cd6+q2@pevik/T/> Cc: Petr Vorel <pvorel@suse.cz> Cc: Jakub Wilk <jwilk@jwilk.net> Cc: Stefan Puiu <stefan.puiu@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'man/man3/gets.3')
-rw-r--r--man/man3/gets.3107
1 files changed, 107 insertions, 0 deletions
diff --git a/man/man3/gets.3 b/man/man3/gets.3
new file mode 100644
index 0000000000..8ffffaaa6f
--- /dev/null
+++ b/man/man3/gets.3
@@ -0,0 +1,107 @@
+'\" t
+.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.\" Modified Wed Jul 28 11:12:07 1993 by Rik Faith (faith@cs.unc.edu)
+.\" Modified Fri Sep 8 15:48:13 1995 by Andries Brouwer (aeb@cwi.nl)
+.\" Modified 2013-12-31, David Malcolm <dmalcolm@redhat.com>
+.\" Split gets(3) into its own page; fgetc() et al. move to fgetc(3)
+.TH gets 3 (date) "Linux man-pages (unreleased)"
+.SH NAME
+gets \- get a string from standard input (DEPRECATED)
+.SH LIBRARY
+Standard C library
+.RI ( libc ", " \-lc )
+.SH SYNOPSIS
+.nf
+.B #include <stdio.h>
+.P
+.BI "[[deprecated]] char *gets(char *" "s" );
+.fi
+.SH DESCRIPTION
+.IR "Never use this function" .
+.P
+.BR gets ()
+reads a line from
+.I stdin
+into the buffer pointed to by
+.I s
+until either a terminating newline or
+.BR EOF ,
+which it replaces with a null byte (\[aq]\e0\[aq]).
+No check for buffer overrun is performed (see BUGS below).
+.SH RETURN VALUE
+.BR gets ()
+returns
+.I s
+on success, and NULL
+on error or when end of file occurs while no characters have been read.
+However, given the lack of buffer overrun checking, there can be no
+guarantees that the function will even return.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lbx lb lb
+l l l.
+Interface Attribute Value
+T{
+.na
+.nh
+.BR gets ()
+T} Thread safety MT-Safe
+.TE
+.SH STANDARDS
+POSIX.1-2008.
+.SH HISTORY
+C89, POSIX.1-2001.
+.P
+LSB deprecates
+.BR gets ().
+POSIX.1-2008 marks
+.BR gets ()
+obsolescent.
+ISO C11 removes the specification of
+.BR gets ()
+from the C language, and since glibc 2.16,
+glibc header files don't expose the function declaration if the
+.B _ISOC11_SOURCE
+feature test macro is defined.
+.SH BUGS
+Never use
+.BR gets ().
+Because it is impossible to tell without knowing the data in advance how many
+characters
+.BR gets ()
+will read, and because
+.BR gets ()
+will continue to store characters past the end of the buffer,
+it is extremely dangerous to use.
+It has been used to break computer security.
+Use
+.BR fgets ()
+instead.
+.P
+For more information, see CWE-242 (aka "Use of Inherently Dangerous
+Function") at
+http://cwe.mitre.org/data/definitions/242.html
+.SH SEE ALSO
+.BR read (2),
+.BR write (2),
+.BR ferror (3),
+.BR fgetc (3),
+.BR fgets (3),
+.BR fgetwc (3),
+.BR fgetws (3),
+.BR fopen (3),
+.BR fread (3),
+.BR fseek (3),
+.BR getline (3),
+.BR getwchar (3),
+.BR puts (3),
+.BR scanf (3),
+.BR ungetwc (3),
+.BR unlocked_stdio (3),
+.BR feature_test_macros (7)