public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: Stas Sergeev via Libc-alpha <libc-alpha@sourceware.org>
Cc: Stas Sergeev <stsp2@yandex.ru>
Subject: Re: [PATCH 1/2] elf: strdup() l_name if no realname [BZ #30100]
Date: Wed, 15 Feb 2023 13:35:52 +0100	[thread overview]
Message-ID: <mvm3577t8bb.fsf@suse.de> (raw)
In-Reply-To: <20230215112110.2426646-2-stsp2@yandex.ru> (Stas Sergeev via Libc-alpha's message of "Wed, 15 Feb 2023 16:21:09 +0500")

On Feb 15 2023, Stas Sergeev via Libc-alpha wrote:

> diff --git a/elf/dl-object.c b/elf/dl-object.c
> index f1f2ec956c..c92daf37d1 100644
> --- a/elf/dl-object.c
> +++ b/elf/dl-object.c
> @@ -122,7 +122,7 @@ _dl_new_object (char *realname, const char *libname, int type,
>  #endif
>      new->l_name = realname;
>    else
> -    new->l_name = (char *) newname->name + libname_len - 1;
> +    new->l_name = __strdup ((char *) newname->name + libname_len - 1);

Since the point of that assignment is to create a pointer to an
allocated empty string, it would be better to make that explicit by
using __strdup (""), with a suitable adjustment of the comment.

-- 
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."

  reply	other threads:[~2023-02-15 12:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 11:21 [PATCH v5 0/2] implement dlmem() with audit extension Stas Sergeev
2023-02-15 11:21 ` [PATCH 1/2] elf: strdup() l_name if no realname [BZ #30100] Stas Sergeev
2023-02-15 12:35   ` Andreas Schwab [this message]
2023-02-15 13:33     ` stsp
2023-02-15 11:21 ` [PATCH 2/2] dlfcn,elf: implement dlmem() function [BZ #11767] Stas Sergeev
  -- strict thread matches above, loose matches on Subject: below --
2023-02-15 13:32 [PATCH v6 0/2] implement dlmem() with audit extension Stas Sergeev
2023-02-15 13:32 ` [PATCH 1/2] elf: strdup() l_name if no realname [BZ #30100] Stas Sergeev
2023-02-14  8:41 [PATCH v4 0/2] implement dlmem() function Stas Sergeev
2023-02-14  8:41 ` [PATCH 1/2] elf: strdup() l_name if no realname [BZ #30100] Stas Sergeev
2023-02-13 13:23 [PATCH v3 0/2] implement dlmem() function Stas Sergeev
2023-02-13 13:23 ` [PATCH 1/2] elf: strdup() l_name if no realname [BZ #30100] Stas Sergeev
2023-02-10 14:07 Stas Sergeev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mvm3577t8bb.fsf@suse.de \
    --to=schwab@suse.de \
    --cc=libc-alpha@sourceware.org \
    --cc=stsp2@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).