[Libosinfo] [libosinfo PATCH] loader: refuse to load non-compliant named files

Christophe Fergeau cfergeau at redhat.com
Fri Jan 4 09:46:46 UTC 2019


Hey, looks good to me,

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Thu, Jan 03, 2019 at 03:56:27PM +0100, Fabiano Fidêncio wrote:
> There was a period of grace needed for backwards compatibility. After 3+
> years, we can safely remove the code instroduced as part of 09ae3cf09
> (which was released on 0.3.0).
> 
> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
> ---
>  osinfo/osinfo_loader.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
> index 77ca5ea..372871e 100644
> --- a/osinfo/osinfo_loader.c
> +++ b/osinfo/osinfo_loader.c
> @@ -523,6 +523,7 @@ static gboolean osinfo_loader_check_id(const gchar *relpath,
>      gchar *reldir;
>      gboolean extension;
>      gsize i;
> +    gboolean ret = FALSE;
>  
>      if (!relpath)
>          return TRUE;
> @@ -555,17 +556,15 @@ static gboolean osinfo_loader_check_id(const gchar *relpath,
>      if (!g_str_equal(extension ? reldir : relpath, name)) {
>          g_warning("Entity %s should be in file %s not %s",
>                    id, name, extension ? reldir : relpath);
> -        g_free(reldir);
> -        g_free(name);
> -        return TRUE; /* In future switch to FALSE to refuse
> -                      * to load non-compliant named files.
> -                      * Need a period of grace for backcompat
> -                      * first though... Switch ETA Jan 2017
> -                      */
> +        goto cleanup;
>      }
> +
> +    ret = TRUE;
> +
> + cleanup:
>      g_free(reldir);
>      g_free(name);
> -    return TRUE;
> +    return ret;
>  }
>  
>  
> -- 
> 2.19.2
> 
> _______________________________________________
> Libosinfo mailing list
> Libosinfo at redhat.com
> https://www.redhat.com/mailman/listinfo/libosinfo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20190104/22dd0bba/attachment.sig>


More information about the Libosinfo mailing list