diff mbox series

[1/2] checkpolicy: free identifiers on invalid typebounds

Message ID 20240330133502.72795-1-cgoettsche@seltendoof.de (mailing list archive)
State Accepted
Commit 9f2f9e28475a
Delegated to: Petr Lautrbach
Headers show
Series [1/2] checkpolicy: free identifiers on invalid typebounds | expand

Commit Message

Christian Göttsche March 30, 2024, 1:35 p.m. UTC
From: Christian Göttsche <cgzones@googlemail.com>

Free the two identifiers on an invalid typebounds in the error branch,
similar to the success branch.

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

Comments

James Carter April 1, 2024, 4:52 p.m. UTC | #1
On Sat, Mar 30, 2024 at 9:35 AM Christian Göttsche
<cgoettsche@seltendoof.de> wrote:
>
> From: Christian Göttsche <cgzones@googlemail.com>
>
> Free the two identifiers on an invalid typebounds in the error branch,
> similar to the success branch.
>
> Reported-by: oss-fuzz (issue 67700)
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

For these two patches:
Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  checkpolicy/policy_define.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
> index 0cf938ea..92d1e5f2 100644
> --- a/checkpolicy/policy_define.c
> +++ b/checkpolicy/policy_define.c
> @@ -1477,8 +1477,12 @@ int define_typebounds(void)
>         }
>
>         while ((id = queue_remove(id_queue))) {
> -               if (define_typebounds_helper(bounds, id))
> +               if (define_typebounds_helper(bounds, id)) {
> +                       free(bounds);
> +                       free(id);
>                         return -1;
> +               }
> +
>                 free(id);
>         }
>         free(bounds);
> --
> 2.43.0
>
>
James Carter April 4, 2024, 4:21 p.m. UTC | #2
On Mon, Apr 1, 2024 at 12:52 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Sat, Mar 30, 2024 at 9:35 AM Christian Göttsche
> <cgoettsche@seltendoof.de> wrote:
> >
> > From: Christian Göttsche <cgzones@googlemail.com>
> >
> > Free the two identifiers on an invalid typebounds in the error branch,
> > similar to the success branch.
> >
> > Reported-by: oss-fuzz (issue 67700)
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> For these two patches:
> Acked-by: James Carter <jwcart2@gmail.com>
>
These two patches have been merged.
Thanks,
Jim

> > ---
> >  checkpolicy/policy_define.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
> > index 0cf938ea..92d1e5f2 100644
> > --- a/checkpolicy/policy_define.c
> > +++ b/checkpolicy/policy_define.c
> > @@ -1477,8 +1477,12 @@ int define_typebounds(void)
> >         }
> >
> >         while ((id = queue_remove(id_queue))) {
> > -               if (define_typebounds_helper(bounds, id))
> > +               if (define_typebounds_helper(bounds, id)) {
> > +                       free(bounds);
> > +                       free(id);
> >                         return -1;
> > +               }
> > +
> >                 free(id);
> >         }
> >         free(bounds);
> > --
> > 2.43.0
> >
> >
diff mbox series

Patch

diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
index 0cf938ea..92d1e5f2 100644
--- a/checkpolicy/policy_define.c
+++ b/checkpolicy/policy_define.c
@@ -1477,8 +1477,12 @@  int define_typebounds(void)
 	}
 
 	while ((id = queue_remove(id_queue))) {
-		if (define_typebounds_helper(bounds, id))
+		if (define_typebounds_helper(bounds, id)) {
+			free(bounds);
+			free(id);
 			return -1;
+		}
+
 		free(id);
 	}
 	free(bounds);