[Libosinfo] [libosinfo] media: Remove ISO header strings' padding

Christophe Fergeau cfergeau at redhat.com
Fri Dec 23 08:14:45 UTC 2016


On Fri, Dec 23, 2016 at 08:26:44AM +0100, Fabiano Fidêncio wrote:
> The strings in the ISO header ("volume-id", "system-id", "publisher-id"
> and "application-id") have a predefined size and are padded with spaces,
> but nothing in on_{pvd,svd}_read() removes these padding spaces from
> those strings, which makes osinfo_media_get_volume_id() always return
> [SOME-ISO-LABEL                  ] rather than the expected
> [SOME-ISO-LABEL].
> 
> Resolves: rhbz#1408271
> 
> Signed-off-by: Fabiano Fidêncio <fabiano at fidencio.org>
> Reported-by: Allan Day <aday at redhat.com>
> ---
>  osinfo/osinfo_media.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
> index b45f4f4..af4bb14 100644
> --- a/osinfo/osinfo_media.c
> +++ b/osinfo/osinfo_media.c
> @@ -712,6 +712,7 @@ static void on_svd_read(GObject *source,
>  
>  
>      data->svd.system[MAX_SYSTEM - 1] = 0;
> +    g_strchomp(data->svd.system);
>  
>      if (strncmp(BOOTABLE_TAG, data->svd.system, sizeof(BOOTABLE_TAG)) != 0) {
>          g_set_error(&error,
> @@ -803,9 +804,16 @@ static void on_pvd_read(GObject *source,
>      }
>  
>      data->pvd.volume[MAX_VOLUME - 1] = 0;
> +    g_strchomp(data->pvd.volume);
> +

Even simpler to fix than I had thought, I had totally forgotten about
g_strchomp() :)

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

Christophe

>      data->pvd.system[MAX_SYSTEM - 1] = 0;
> +    g_strchomp(data->pvd.system);
> +
>      data->pvd.publisher[MAX_PUBLISHER - 1] = 0;
> +    g_strchomp(data->pvd.publisher);
> +
>      data->pvd.application[MAX_APPLICATION - 1] = 0;
> +    g_strchomp(data->pvd.application);
>  
>      if (is_str_empty(data->pvd.volume)) {
>          g_set_error(&error,
> -- 
> 2.9.3
> 
> _______________________________________________
> 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: 801 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20161223/1ff16d39/attachment.sig>


More information about the Libosinfo mailing list