From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 555FB1F55B for ; Thu, 21 May 2020 19:43:49 +0000 (UTC) Received: from localhost ([::1]:50884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbr6a-0003on-G3 for normalperson@yhbt.net; Thu, 21 May 2020 15:43:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbr20-0001mv-IC for bug-gnulib@gnu.org; Thu, 21 May 2020 15:39:04 -0400 Received: from mo6-p01-ob.smtp.rzone.de ([2a01:238:20a:202:5301::3]:13814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbr1y-0004j3-Be for bug-gnulib@gnu.org; Thu, 21 May 2020 15:39:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1590089936; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=LsJJfljz7ndZCbA3Igvba1DXh0TpJNR/1pd5MZZl/IQ=; b=srXTYF63Ru7WSJoPNpg3LMBR0gy6m2m/kUDH1PkB54uTJuwGnxi5mmW7P0FZflshtq GHyQ7j0o+GggH9Z0jct1EOakaCswNcBP94DEh8U8cANga2ax7rHtG/N62RGmlVMeNO4b I35EQ4P64U/DhpLXQjRE4IYCkZuPRw3ISnsLuXrHiVYdYLNh92o6oJKFgTGfFzZ0v+9W fT8QgPkoAdwQahf9Q5g4JgNZQgCInl7QdhxDbnr0VFRyMrVStDkVkBgU2IA6+zDkMvoz LkbbsP3xvEgGY8ruQqw3SR6pKVXlHpzwpgh/nUGmYpa17hbOLHBPuKLKh72RU/irVlIl DerA== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOH6fzxfs=" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 46.7.0 DYNA|AUTH) with ESMTPSA id x0bd30w4LJctEhI (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Thu, 21 May 2020 21:38:55 +0200 (CEST) From: Bruno Haible To: Paul Eggert Subject: Re: Fix memleak in getdelim.m4 Date: Thu, 21 May 2020 21:38:55 +0200 Message-ID: <4508066.d9GOY8cg3r@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-177-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <99e684fe-341f-4ba8-607f-b8c52f98886a@cs.ucla.edu> References: <2212015.vQoj23DsGF@omega> <99e684fe-341f-4ba8-607f-b8c52f98886a@cs.ucla.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=2a01:238:20a:202:5301::3; envelope-from=bruno@clisp.org; helo=mo6-p01-ob.smtp.rzone.de X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tim =?ISO-8859-1?Q?R=FChsen?= , bug-gnulib@gnu.org Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Paul Eggert wrote: > > - if (memmem (haystack, 3, NULL, 0) != haystack) > > + if (memmem (haystack, 3, (const char *) 1, 0) != haystack) > > This has undefined behavior in general, no? No. memmem is not supposed to access more than NEEDLELEN bytes at NEEDLE. > How about using '""' instead of '(const char *) 1'? That would defeat the purpose of the test, which is to test for the glibc 2.0 bug [1]. Bruno [1] http://man7.org/linux/man-pages/man3/memmem.3.html