public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Siddhesh Poyarekar via Libc-alpha <libc-alpha@sourceware.org>
Cc: Siddhesh Poyarekar <siddhesh@sourceware.org>,  schwab@linux-m68k.org
Subject: Re: [PATCH] iconvconfig: Fix multiple issues
Date: Fri, 25 Jun 2021 09:26:46 +0200	[thread overview]
Message-ID: <87lf6yievd.fsf@oldenburg.str.redhat.com> (raw)
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")

* 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


      reply	other threads:[~2021-06-25  7:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25  6:09 Siddhesh Poyarekar
2021-06-25  7:26 ` Florian Weimer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf6yievd.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@linux-m68k.org \
    --cc=siddhesh@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).