diff mbox series

checkpolicy: avoid leak of identifier on required attribute

Message ID 20241106104906.29847-1-cgoettsche@seltendoof.de (mailing list archive)
State Accepted
Commit 77747a36a9af
Delegated to: Petr Lautrbach
Headers show
Series checkpolicy: avoid leak of identifier on required attribute | expand

Commit Message

Christian Göttsche Nov. 6, 2024, 10:49 a.m. UTC
From: Christian Göttsche <cgzones@googlemail.com>

Example policy generated by fuzzer:

    class s
    sid k
    class s { i }
    optional{
      require{
        attribute i;
      }
    }
    type m;
    typealias m alias i;

    typeai

Reported-by: oss-fuzz (issue 377576480)
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 checkpolicy/policy_define.c | 1 +
 1 file changed, 1 insertion(+)

Comments

James Carter Nov. 6, 2024, 8:04 p.m. UTC | #1
On Wed, Nov 6, 2024 at 5:52 AM Christian Göttsche
<cgoettsche@seltendoof.de> wrote:
>
> From: Christian Göttsche <cgzones@googlemail.com>
>
> Example policy generated by fuzzer:
>
>     class s
>     sid k
>     class s { i }
>     optional{
>       require{
>         attribute i;
>       }
>     }
>     type m;
>     typealias m alias i;
>
>     typeai
>
> Reported-by: oss-fuzz (issue 377576480)
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  checkpolicy/policy_define.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
> index 9aae8378..96414d46 100644
> --- a/checkpolicy/policy_define.c
> +++ b/checkpolicy/policy_define.c
> @@ -1322,6 +1322,7 @@ static int add_aliases_to_type(type_datum_t * type)
>                                 aliasdatum->primary = type->s.value;
>                                 aliasdatum->flavor = TYPE_ALIAS;
>
> +                               free(id);
>                                 break;
>                         }
>                 default:{
> --
> 2.45.2
>
>
James Carter Nov. 18, 2024, 8:14 p.m. UTC | #2
On Wed, Nov 6, 2024 at 3:04 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Wed, Nov 6, 2024 at 5:52 AM Christian Göttsche
> <cgoettsche@seltendoof.de> wrote:
> >
> > From: Christian Göttsche <cgzones@googlemail.com>
> >
> > Example policy generated by fuzzer:
> >
> >     class s
> >     sid k
> >     class s { i }
> >     optional{
> >       require{
> >         attribute i;
> >       }
> >     }
> >     type m;
> >     typealias m alias i;
> >
> >     typeai
> >
> > Reported-by: oss-fuzz (issue 377576480)
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> Acked-by: James Carter <jwcart2@gmail.com>
>

Merged.
Thanks,
Jim

> > ---
> >  checkpolicy/policy_define.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
> > index 9aae8378..96414d46 100644
> > --- a/checkpolicy/policy_define.c
> > +++ b/checkpolicy/policy_define.c
> > @@ -1322,6 +1322,7 @@ static int add_aliases_to_type(type_datum_t * type)
> >                                 aliasdatum->primary = type->s.value;
> >                                 aliasdatum->flavor = TYPE_ALIAS;
> >
> > +                               free(id);
> >                                 break;
> >                         }
> >                 default:{
> > --
> > 2.45.2
> >
> >
diff mbox series

Patch

diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
index 9aae8378..96414d46 100644
--- a/checkpolicy/policy_define.c
+++ b/checkpolicy/policy_define.c
@@ -1322,6 +1322,7 @@  static int add_aliases_to_type(type_datum_t * type)
 				aliasdatum->primary = type->s.value;
 				aliasdatum->flavor = TYPE_ALIAS;
 
+				free(id);
 				break;
 			}
 		default:{