1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Modified Wed Jul 28 11:12:07 1993 by Rik Faith (faith@cs.unc.edu)
26 .\" Modified Fri Sep 8 15:48:13 1995 by Andries Brouwer (aeb@cwi.nl)
27 .\" Modified 2013-12-31, David Malcolm <dmalcolm@redhat.com>
28 .\" Split gets(3) into its own page; fgetc() et al. move to fgetc(3)
29 .TH GETS 3 2017-09-15 "GNU" "Linux Programmer's Manual"
31 gets \- get a string from standard input (DEPRECATED)
36 .BI "char *gets(char *" "s" );
39 .IR "Never use this function" .
44 into the buffer pointed to by
46 until either a terminating newline or
48 which it replaces with a null byte (\(aq\e0\(aq).
49 No check for buffer overrun is performed (see BUGS below).
55 on error or when end of file occurs while no characters have been read.
56 However, given the lack of buffer overrun checking, there can be no
57 guarantees that the function will even return.
59 For an explanation of the terms used in this section, see
65 Interface Attribute Value
68 T} Thread safety MT-Safe
72 C89, C99, POSIX.1-2001.
79 ISO C11 removes the specification of
81 from the C language, and since version 2.16,
82 glibc header files don't expose the function declaration if the
84 feature test macro is defined.
88 Because it is impossible to tell without knowing the data in advance how many
91 will read, and because
93 will continue to store characters past the end of the buffer,
94 it is extremely dangerous to use.
95 It has been used to break computer security.
100 For more information, see CWE-242 (aka "Use of Inherently Dangerous
102 http://cwe.mitre.org/data/definitions/242.html
119 .BR unlocked_stdio (3),
120 .BR feature_test_macros (7)