[PATCH] elf: Assert range of ns argument in _dl_debug_initialize

Andreas Schwab schwab@linux-m68k.org
Mon Jun 28 07:26:08 GMT 2021


On Jun 23 2021, Florian Weimer via Libc-alpha wrote:

> @@ -49,7 +51,11 @@ _dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns)
>    if (ns == LM_ID_BASE)
>      r = &_r_debug;
>    else
> -    r = &GL(dl_ns)[ns]._ns_debug;
> +    {
> +      assert (ns >= 0);
> +      assert (ns < array_length (GL (dl_ns)));

The asserts can be combined.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Libc-alpha mailing list