2 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" Modified Wed Jul 28 11:12:07 1993 by Rik Faith (faith@cs.unc.edu)
7 .\" Modified Fri Sep 8 15:48:13 1995 by Andries Brouwer (aeb@cwi.nl)
8 .\" Modified 2013-12-31, David Malcolm <dmalcolm@redhat.com>
9 .\" Split gets(3) into its own page; fgetc() et al. move to fgetc(3)
10 .TH gets 3 (date) "Linux man-pages (unreleased)"
12 gets \- get a string from standard input (DEPRECATED)
15 .RI ( libc ", " \-lc )
20 .BI "[[deprecated]] char *gets(char *" "s" );
23 .IR "Never use this function" .
28 into the buffer pointed to by
30 until either a terminating newline or
32 which it replaces with a null byte (\[aq]\e0\[aq]).
33 No check for buffer overrun is performed (see BUGS below).
39 on error or when end of file occurs while no characters have been read.
40 However, given the lack of buffer overrun checking, there can be no
41 guarantees that the function will even return.
43 For an explanation of the terms used in this section, see
49 Interface Attribute Value
54 T} Thread safety MT-Safe
66 ISO C11 removes the specification of
68 from the C language, and since glibc 2.16,
69 glibc header files don't expose the function declaration if the
71 feature test macro is defined.
75 Because it is impossible to tell without knowing the data in advance how many
78 will read, and because
80 will continue to store characters past the end of the buffer,
81 it is extremely dangerous to use.
82 It has been used to break computer security.
87 For more information, see CWE-242 (aka "Use of Inherently Dangerous
89 http://cwe.mitre.org/data/definitions/242.html
106 .BR unlocked_stdio (3),
107 .BR feature_test_macros (7)