From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24962 invoked from network); 18 Dec 2020 10:52:14 -0000 Received: from ewsd.inri.net (107.191.116.128) by inbox.vuxu.org with ESMTPUTF8; 18 Dec 2020 10:52:14 -0000 Received: from mail-ua1-f53.google.com ([209.85.222.53]) by ewsd; Fri Dec 18 05:48:17 -0500 2020 Received: by mail-ua1-f53.google.com with SMTP id t15so666037ual.6 for <9front@9front.org>; Fri, 18 Dec 2020 02:48:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=zvp04yfI2c5T2nYxSlWxrupoVk1R55SnunrF+Rgf8VE=; b=Y/kO8abkEPDG3WGpOAgbsnAyWr7y4aL8NPv+Q7cZCb3BQU/h7jYW5j140V9VTDPamb RDpghNmMJQUO1/7xExbsDAvJDX4mHC0Xrh9YRDGf5clFOQH8sh9KQN8dtA1cLDpjhZTe rysuU6jBj9jTdHkvOvWU7hw+FQqhctXZCplUahmzYGtwgzDbdFAhvuRXDiWkvTP3Zr9r 9qNa2fONPJJjyK9eczbvGdh4rHqgM2s2CW1a+5btySeB51PweNhMCNkbXBEmBh+x+LVt v0x0iNaDZSC3dlW7rkiK0pmDTh06CbIETskDY/2yvzjGevun3cXOGEhxAMQNgWVkWc9n tKWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=zvp04yfI2c5T2nYxSlWxrupoVk1R55SnunrF+Rgf8VE=; b=oevg2fV/LuTA/iEFWpRNUwxSvfD44AtG8m30FPPoPaNxMKhlaHjpCGcJv+oUbL5l0w bgJZ9wOXMkZiwgdqyBL1vDrzaQF8X2IwjSDbsc8gbaC0xE1vyKk6dMdXjDixX59ai/i6 ip/3dmZgWSLIuy2qq6qeW5jDJCqSfNwwbnn65GEzU3IJWQesFTfk39ppHiIsD9kX8Ct1 QMrXmk14l5RxHgIrQ1wDlY8FS4q1dPz4S44pkkYu75TxLIYx5em2i0Y7y/W3wuVrv8u2 5dzCZ4bNNchkJxeodRtD3wHMsIWviLu6Mhbzmf6U8VcOE6i0trwxIpL1itZWTlHSsdR9 wQJg== X-Gm-Message-State: AOAM531JuWG2Vq29id83eJmMeIaykqs7Gs4BdAV/xKrDi9qgD4yhrkub ncoQZTDQx/A5xNxbNOTfvJWPSIKRkWyitC0JXoI= X-Google-Smtp-Source: ABdhPJwplbpPW5l+0Nt+aZkuivAT1cany3PxWk+IaD483poDu4aUhJVjs7UksAauM/kLa4z5mqgAW1QUQpQpRlmhSYM= X-Received: by 2002:ab0:2010:: with SMTP id v16mr2892344uak.24.1608288488897; Fri, 18 Dec 2020 02:48:08 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a67:e319:0:0:0:0:0 with HTTP; Fri, 18 Dec 2020 02:48:08 -0800 (PST) In-Reply-To: <54874114B98195307A5780FB707F9115@gmail.com> References: <54874114B98195307A5780FB707F9115@gmail.com> From: Kemal Date: Fri, 18 Dec 2020 13:48:08 +0300 Message-ID: To: =?UTF-8?Q?Sigrid_Solveig_Hafl=C3=ADnud=C3=B3ttir?= Cc: 9front@9front.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: stateless virtualized information blockchain controller Subject: Re: [9front] strndup should use strnlen and memcpy Reply-To: 9front@9front.org Precedence: bulk 2020-12-18 13:31 GMT+03:00, Sigrid Solveig Hafl=C3=ADnud=C3=B3ttir : >> Open Group does not specify if arg1 should be null terminated or not. >> https://pubs.opengroup.org/onlinepubs/9699919799/functions/strdup.html > > "Applications should not assume that strndup() will allocate ( size + 1) > bytes when strlen(s) is smaller than size." > > Pretty sure this means it's supposed to be null-terminated, or > otherwise it wouldn't mention the "dangerous" strlen right there. > > I don't know, I also think that str is \0 terminated but that seems a bit unclear.