From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 7AD1539BB036 for ; Fri, 25 Jun 2021 07:26:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7AD1539BB036 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-276-WURD-nEnNLWbHtES9HmBrw-1; Fri, 25 Jun 2021 03:26:50 -0400 X-MC-Unique: WURD-nEnNLWbHtES9HmBrw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 748EC1084F4C; Fri, 25 Jun 2021 07:26:49 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-228.ams2.redhat.com [10.36.112.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 54D8217C5F; Fri, 25 Jun 2021 07:26:48 +0000 (UTC) From: Florian Weimer To: Siddhesh Poyarekar via Libc-alpha Cc: Siddhesh Poyarekar , schwab@linux-m68k.org Subject: Re: [PATCH] iconvconfig: Fix multiple issues References: <20210625060913.300418-1-siddhesh@sourceware.org> Date: Fri, 25 Jun 2021 09:26:46 +0200 In-Reply-To: <20210625060913.300418-1-siddhesh@sourceware.org> (Siddhesh Poyarekar via Libc-alpha's message of "Fri, 25 Jun 2021 11:39:13 +0530") Message-ID: <87lf6yievd.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jun 2021 07:26:53 -0000 * Siddhesh Poyarekar via Libc-alpha: > It was noticed on big-endian systems that msgfmt would fail with the > following error: > > msgfmt: gconv_builtin.c:70: __gconv_get_builtin_trans: Assertion `cnt < sizeof (map) / sizeof (map[0])' failed. > Aborted (core dumped) > > This is only seen on installed systems because it was due to a > corrupted gconv-modules.cache. iconvconfig had the following issues > (it was specifically freeing fulldir that caused this issue, but other > cleanups are also needed) that this patch fixes. > > - Add prefix only if dir starts with '/' > - Use stpcpy instead of mempcpy so that the directory string is NULL > terminated > > - Do not free fulldir because it is used later while writing out the > gconv-modules.cache file. I suggest to use asprintf. This code is hardly performance critical, and asprintf avoids such bugs. I expect that static analysis tools can detect the missing free calls, so I think we should still free those allocations. Thanks, Florian