From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 98a556cf for ; Thu, 21 Nov 2019 21:49:17 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 70D809C147; Fri, 22 Nov 2019 07:49:16 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 55FA693D71; Fri, 22 Nov 2019 07:48:51 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id 8625193D71; Fri, 22 Nov 2019 07:48:48 +1000 (AEST) Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) by minnie.tuhs.org (Postfix) with ESMTPS id D588F93D59 for ; Fri, 22 Nov 2019 07:48:47 +1000 (AEST) Received: by sdaoden.eu (Postfix, from userid 1000) id 217BD16054; Thu, 21 Nov 2019 22:48:46 +0100 (CET) Date: Thu, 21 Nov 2019 22:48:44 +0100 From: Steffen Nurpmeso To: Dave Horsfall Message-ID: <20191121214844.hQIAt%steffen@sdaoden.eu> In-Reply-To: References: <1573592179.5935.for-standards-violators@oclsc.org> <20191112221053.C2009156E80B@mail.bitblocks.com> Mail-Followup-To: Dave Horsfall , The Eunuchs Hysterical Society User-Agent: s-nail v14.9.15-219-g336589c5 OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. Subject: Re: [TUHS] buffer overflow (Re: Happy birthday Morris worm X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: The Eunuchs Hysterical Society Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" Dave Horsfall wrote in : |On Tue, 19 Nov 2019, Tony Finch wrote: |> Amusingly POSIX says the C standard takes precedence wrt the details of |> gets() (and other library functions) and C18 abolished gets(). I'm |> slightly surprised that the POSIX committee didn't see that coming and |> include the change in the 2018 edition... This week (on the 19th, to be exact) Geoff Clare made official the desire to align a forthcoming POSIX Issue 8 with ISO C17. Current POSIX (1003.1(2016)/Issue7+TC2) still aligns with C99. And, compared to C99, the POSIX wording causes sympathy d37021 APPLICATION USAGE 37022 Reading a line that overflows the array pointed to by s results in undefined behavior. The use of 37023 fgets( ) is recommended. 37024 Since the user cannot specify the length of the buffer passed to gets( ), use of this function is 37025 discouraged. The length of the string read is unlimited. It is possible to overflow this buffer in 37026 such a way as to cause applications to fail, or possible system security violations. 37027 Applications should use the fgets( ) function instead of the obsolescent gets( ) function. 37028 RATIONALE 37029 The standard developers decided to mark the gets( ) function as obsolescent even though it is in 37030 the ISO C standard due to the possibility of buffer overflow. 37031 FUTURE DIRECTIONS 37032 The gets( ) function may be removed in a future version. |Didn't know that gets() had finally been abolished; it's possibly the most |unsafe function (OK, macro) on the planet. I've long been tempted to |remove gets() and see what breaks... It seems to have been removed in C 2011, except get_s(), which is still present in the C 2017 draft that i have. (I have never used any of the _s() functions.) --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)