public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Don't use unsupported format string in ld.so (bug 29427)
@ 2022-08-01 14:46 Andreas Schwab
  2022-08-01 15:49 ` Florian Weimer
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2022-08-01 14:46 UTC (permalink / raw)
  To: libc-alpha

There is no support for printf format strings that contain a literal field
width or precision in the dynamic loader, they have to be specified
indirectly.
---
 elf/dl-diagnostics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elf/dl-diagnostics.c b/elf/dl-diagnostics.c
index dd3871b1e0..269c428c93 100644
--- a/elf/dl-diagnostics.c
+++ b/elf/dl-diagnostics.c
@@ -108,7 +108,7 @@ _dl_diagnostics_print_labeled_value (const char *label, uint64_t value)
       if (high == 0)
         _dl_printf ("%s=0x%x\n", label, low);
       else
-        _dl_printf ("%s=0x%x%08x\n", label, high, low);
+        _dl_printf ("%s=0x%x%0*x\n", label, high, 8, low);
     }
 }
 
-- 
2.37.1


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Don't use unsupported format string in ld.so (bug 29427)
  2022-08-01 14:46 [PATCH] Don't use unsupported format string in ld.so (bug 29427) Andreas Schwab
@ 2022-08-01 15:49 ` Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2022-08-01 15:49 UTC (permalink / raw)
  To: Andreas Schwab via Libc-alpha; +Cc: Andreas Schwab

* Andreas Schwab via Libc-alpha:

> There is no support for printf format strings that contain a literal field
> width or precision in the dynamic loader, they have to be specified
> indirectly.
> ---
>  elf/dl-diagnostics.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/elf/dl-diagnostics.c b/elf/dl-diagnostics.c
> index dd3871b1e0..269c428c93 100644
> --- a/elf/dl-diagnostics.c
> +++ b/elf/dl-diagnostics.c
> @@ -108,7 +108,7 @@ _dl_diagnostics_print_labeled_value (const char *label, uint64_t value)
>        if (high == 0)
>          _dl_printf ("%s=0x%x\n", label, low);
>        else
> -        _dl_printf ("%s=0x%x%08x\n", label, high, low);
> +        _dl_printf ("%s=0x%x%0*x\n", label, high, 8, low);
>      }
>  }
>  
> -- 
>
> 2.37.1

Looks okay to me.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-01 15:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01 14:46 [PATCH] Don't use unsupported format string in ld.so (bug 29427) Andreas Schwab
2022-08-01 15:49 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).