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 19086 invoked from network); 18 Dec 2020 14:42:56 -0000 Received: from ewsd.inri.net (107.191.116.128) by inbox.vuxu.org with ESMTPUTF8; 18 Dec 2020 14:42:56 -0000 Received: from mail-ot1-f49.google.com ([209.85.210.49]) by ewsd; Fri Dec 18 09:34:25 -0500 2020 Received: by mail-ot1-f49.google.com with SMTP id h18so2019860otq.12 for <9front@9front.org>; Fri, 18 Dec 2020 06:34:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=duxbEPinepwJ5+rXp5uUhOgXxoiODxoF3uyGmykrdUU=; b=OiGq/7jTUZlPeZ2YdSAQY+LsocLfgyXHKpknuN7zFSKgZNQ+Io5SbNdbtPgfTStRdG MhhZcQRNAXhnKo7VwNUQK1drTt3c1XGs6QwPGFs8+OYDpELUxCqGeKZLzi4ihaM9dtGG PPCdDli+8QZUKWnKPmPMmirOnmMvsY4o+Y3S6Khtvz9fH9Z3wl/dJ/SJz5pdrm8QT/vV +Bm2V8dqtCP3/IEptoJ0ZWluihRr6F/lMqUomfZvrKwr5IM7HcD5gmBSvrRnkbrqcxac /QAThX3h83/jfMSgudLxpbzBKh7dtKjozTEwwqtkZ9pZIDQ5hUX/9MEQQcx4PGKD/77s Ar9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=duxbEPinepwJ5+rXp5uUhOgXxoiODxoF3uyGmykrdUU=; b=faqMj8eWjXkPE09Mb6HqR6Xi7qup3jmljuI2w8ih6osniY4kB0BnbxKGlA/+HCb2uP l+7aguXkawkER6Jv4BA5mG2vHPd/3Vm+mMtt7mY8nFv6EoPrP4xXaTPZ1TTTOCRCFcLA EpDRGdv7fthKvy56tLNihgJb8PZBxkH3NK39LjNrkfS9G31frDv7wEmf1nlYLL+gu3Ab 7DpvQ3ulsSg0inti/PE8215JmRgsT+VmR/9GPcSqb9wrG76bgseCuoZ/qKqK80eBN107 jnYFcs+0S2NxlRQteH9tKTliaRNAg+asXLn307eSt51EeroKGhj8NL6vLnYOK0V3A8jS +kOA== X-Gm-Message-State: AOAM532sGbxZzKpGs1qhGpb7YO/18HTdxrkIlVDqaV7UyCARRSD0Pfsc LGQnS1RSTnhQF6NOuySdm5iCN6JnQZ6pKE2MtmXgQqVVM1ltNg== X-Google-Smtp-Source: ABdhPJwB8DpmnZUP1Ym+Epg0syYp9RdiXZhm2kZGjECkHuvLr0zKIL31Q8CS2kIGZ1QdvV7/64BCU1ln9tCyk1m4MAk= X-Received: by 2002:a05:6830:22c9:: with SMTP id q9mr2983173otc.48.1608302057027; Fri, 18 Dec 2020 06:34:17 -0800 (PST) MIME-Version: 1.0 References: <54874114B98195307A5780FB707F9115@gmail.com> In-Reply-To: <54874114B98195307A5780FB707F9115@gmail.com> From: "Devon H. O'Dell" Date: Fri, 18 Dec 2020 06:34:05 -0800 Message-ID: To: 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: compliant out-scaling extension-aware map/reduce interface Subject: Re: [9front] strndup should use strnlen and memcpy Reply-To: 9front@9front.org Precedence: bulk On Fri, Dec 18, 2020 at 2:31 AM Sigrid Solveig Hafl=C3=ADnud=C3=B3ttir wrote: > > > 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." (As this pertains to my last message, it's also possible for the interface to malloc(size + 1), copy N bytes, and realloc(N+1). This allows that statement to be true while still not requiring the input to be a string when it exceeds size.)