All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Carter <jwcart2@gmail.com>
To: Petr Lautrbach <plautrba@redhat.com>
Cc: SElinux list <selinux@vger.kernel.org>
Subject: Re: [PATCH 1/3] libsemanage: Fix USE_AFTER_FREE (CWE-672) in semanage_direct_get_module_info()
Date: Mon, 4 Apr 2022 15:22:41 -0400	[thread overview]
Message-ID: <CAP+JOzTF1BC6hF7-nb+qBGpoAuC_VH5Ts+=CZZGj3hE1DD=X-g@mail.gmail.com> (raw)
In-Reply-To: <20220401133549.122069-1-plautrba@redhat.com>

On Fri, Apr 1, 2022 at 11:54 AM Petr Lautrbach <plautrba@redhat.com> wrote:
>
> >From fclose(3):
> Upon successful completion, 0 is returned.  Otherwise, EOF is returned
> and errno is set to indicate the error. In either case, any further
> access (including another call to fclose()) to the stream results in
> undefined behavior.
>
> Signed-off-by: Petr Lautrbach <plautrba@redhat.com>

For all three patches:
Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  libsemanage/src/direct_api.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c
> index d83941b05ca1..d5716ce579e9 100644
> --- a/libsemanage/src/direct_api.c
> +++ b/libsemanage/src/direct_api.c
> @@ -2293,6 +2293,7 @@ static int semanage_direct_get_module_info(semanage_handle_t *sh,
>         tmp = NULL;
>
>         if (fclose(fp) != 0) {
> +               fp = NULL;
>                 ERR(sh,
>                     "Unable to close %s module lang ext file.",
>                     (*modinfo)->name);
> --
> 2.35.1
>

  parent reply	other threads:[~2022-04-04 21:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 13:35 [PATCH 1/3] libsemanage: Fix USE_AFTER_FREE (CWE-672) in semanage_direct_get_module_info() Petr Lautrbach
2022-04-01 13:35 ` [PATCH 2/3] semodule_package: Close leaking fd Petr Lautrbach
2022-04-01 13:35 ` [PATCH 3/3] mcstrans: Fir RESOURCE_LEAK and USE_AFTER_FREE coverity scan defects Petr Lautrbach
2022-04-04 19:22 ` James Carter [this message]
2022-04-06  9:34   ` [PATCH 1/3] libsemanage: Fix USE_AFTER_FREE (CWE-672) in semanage_direct_get_module_info() Petr Lautrbach

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='CAP+JOzTF1BC6hF7-nb+qBGpoAuC_VH5Ts+=CZZGj3hE1DD=X-g@mail.gmail.com' \
    --to=jwcart2@gmail.com \
    --cc=plautrba@redhat.com \
    --cc=selinux@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.