All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <plautrba@redhat.com>
To: James Carter <jwcart2@gmail.com>
Cc: SElinux list <selinux@vger.kernel.org>
Subject: Re: [PATCH] libsepol/cil: Fix detected RESOURCE_LEAK (CWE-772)
Date: Mon, 13 Sep 2021 15:47:31 +0200	[thread overview]
Message-ID: <87r1dsa8p8.fsf@redhat.com> (raw)
In-Reply-To: <CAP+JOzSPPvutC=U_zMpd_=VVLvmAcTkiGQ8Q99G_vscLPSazgQ@mail.gmail.com>

James Carter <jwcart2@gmail.com> writes:

> On Thu, Sep 9, 2021 at 12:45 PM Petr Lautrbach <plautrba@redhat.com> wrote:
>>
>> libsepol/cil/src/cil_binary.c:4823: alloc_arg: "bounds_check_type" allocates memory that is stored into "bad".
>> libsepol/cil/src/cil_binary.c:4840: var_assign: Assigning: "cur" = "bad".
>> libsepol/cil/src/cil_binary.c:4844: noescape: Resource "cur" is not freed or pointed-to in "cil_avrule_from_sepol".
>> libsepol/cil/src/cil_binary.c:4847: leaked_storage: Variable "cur" going out of scope leaks the storage it points to.
>> libsepol/cil/src/cil_binary.c:4847: leaked_storage: Variable "bad" going out of scope leaks the storage it points to.
>>
>> Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
>
> Acked-by: James Carter <jwcart2@gmail.com>

Merged.


>> ---
>>  libsepol/cil/src/cil_binary.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/libsepol/cil/src/cil_binary.c b/libsepol/cil/src/cil_binary.c
>> index 43c37fc24686..4a80cb562424 100644
>> --- a/libsepol/cil/src/cil_binary.c
>> +++ b/libsepol/cil/src/cil_binary.c
>> @@ -4842,6 +4842,7 @@ static int cil_check_type_bounds(const struct cil_db *db, policydb_t *pdb, void
>>                                 rc = cil_avrule_from_sepol(pdb, cur, &target, type_value_to_cil, class_value_to_cil, perm_value_to_cil);
>>                                 if (rc != SEPOL_OK) {
>>                                         cil_log(CIL_ERR, "Failed to convert sepol avrule to CIL\n");
>> +                                       bounds_destroy_bad(bad);
>>                                         goto exit;
>>                                 }
>>                                 __cil_print_rule("  ", "allow", &target);
>> --
>> 2.32.0
>>


  reply	other threads:[~2021-09-13 13:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09 16:44 [PATCH] libsepol/cil: Fix detected RESOURCE_LEAK (CWE-772) Petr Lautrbach
2021-09-09 17:25 ` James Carter
2021-09-13 13:47   ` Petr Lautrbach [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-04-30 15:30 Vit Mojzis
2024-04-30 17:31 ` James Carter
2024-05-02 18:06   ` James Carter

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=87r1dsa8p8.fsf@redhat.com \
    --to=plautrba@redhat.com \
    --cc=jwcart2@gmail.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.