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 10357 invoked from network); 18 Dec 2020 13:30:01 -0000 Received: from ewsd.inri.net (107.191.116.128) by inbox.vuxu.org with ESMTPUTF8; 18 Dec 2020 13:30:01 -0000 Received: from mail-lf1-f42.google.com ([209.85.167.42]) by ewsd; Fri Dec 18 08:22:32 -0500 2020 Received: by mail-lf1-f42.google.com with SMTP id a12so5360336lfl.6 for <9front@9front.org>; Fri, 18 Dec 2020 05:22:23 -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; bh=QC1mciLzGgVnFh8bkXxOM2nlvBEbPsKbAuGVMZp+/r4=; b=Yrw6AyKLLGEMquYOBdE9yXVn7/dP+2/iQvI3wYOseqJeTrDHxNJOaKHzeITrY+nHg8 FZBRBhoUI3V0t1Aj+lGSRjDnaFjeLxrXcW1esN6k0Fo94v+54fR9EhKz7k2Y9uR0vYfx ZCdhpneOzzQYHGFqCOXk3OaVkhQ3l6OMi4Q5CACvBwuKZtve+jhSvkZZpgqvKU2G4qIQ e7SMw4BSoLw5nlRU7EbbMWyTmVl5wyEiiJWzZPD/TO59bZGB/r1H3REC7fkT/W2h4eoC zX9viQEumLROjAzJG/li+c8PBCKt4R2VVdGzJc1l2ZgvwUZVDTcAFWPfPbI0G4D81hrN gGgw== 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; bh=QC1mciLzGgVnFh8bkXxOM2nlvBEbPsKbAuGVMZp+/r4=; b=HgCFoMJqqBTFIh8lMUvsaXXAtQGnQXSGXjTGT44iqHl9bSzVmnifzMoTJwKC6+8q6V OyDt5VDZrCKJEappd+LqjmKOcmINH3iQJfnaKoW9meOjGVZa3/GMuwDwzq+lhaYayGpJ FI5mx8sDBh6VeXMsPXPoIemvCPdsc+TVTG4FzOgX5SAkDiTzUWEszq7W4sbqFrLncsOX 1mcExVtlLrG5bkTEipAMXSNYiEQq4juFp/A33LtHH5G7/ulloFMrlodmceD4GWSdrcc/ z6tCiAUNrFCc282uCCx1Puwswzr0/twBULY+TX+1wGKiUWgkB1Rz/Js9ZOf0SyOBaGyo HPLQ== X-Gm-Message-State: AOAM531hZ1RWyq14nscPmSxhRoMOr5lryLPqqubXvt+8srW94eowiCwT At2Clj34PTetbGYgHk5hgU9tjDja18VChv6kwq+YbSnP0mE03w== X-Google-Smtp-Source: ABdhPJzjF3DyAxXpMSpA6YvS1VQyVutBjwgQHYzfylNtiVUNOltT0E/DWQr1JnESnWi6DBXkrKcPzCwYv+VgVWo+1cU= X-Received: by 2002:a19:c815:: with SMTP id y21mr1450896lff.324.1608297742430; Fri, 18 Dec 2020 05:22:22 -0800 (PST) MIME-Version: 1.0 References: <20201218112914.GA717@polynum.com> In-Reply-To: From: =?UTF-8?B?Sm9zw6kgTWlndWVsIFPDoW5jaGV6IEdhcmPDrWE=?= Date: Fri, 18 Dec 2020 14:22:10 +0100 Message-ID: To: 9front@9front.org Content-Type: text/plain; charset="UTF-8" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: ACPI configuration factory Subject: Re: [9front] strndup should use strnlen and memcpy Reply-To: 9front@9front.org Precedence: bulk I'd also use strnlen. My current understanding is: strnlen is used to impose a limit on a bigger str, without caring about its end if it is bigger than size chars. strncmp compares strings up to a limit, without caring about their ends if they are bigger than size chars. The "n" limitation disregards the terminator, so here we shouldn't make exception. Also, using strnlen makes strndup unaware of the problem, relying on the correct behavior of strnlen. The only drawback would be efficiency, but let's be honest: that branch will be predicted pretty easily by modern CPU. Just my 2 cents, take all of this with a grain of salt. On Fri, Dec 18, 2020 at 1:00 PM Eli Cohen wrote: > > I know what we should do but have no idea on a personal level > > On Fri, Dec 18, 2020 at 3:53 AM Kemal wrote: > > > > At this point I have no idea what we should do now.