From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id D08293858D33 for ; Wed, 15 Feb 2023 12:35:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D08293858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 7D52C22E1C; Wed, 15 Feb 2023 12:35:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1676464553; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nBVOWopFYGuyoJZZo7su/oJYSyPKj4iph+gUYVuAS1s=; b=x/l71rTiQTV54upfqR9Q4f+uzRnUBT3owppkvKYsovqEBeqCL9SxfOrjW+bVIflbOiPysR yL85uyHYpappq+Fl95VCrZmq6LY9JfKqaeBMfZhHfkmWfRZzb7+skGZ+alpJxl47SEYXVq 5bIxJ3AfWwiVhvFN6EQ98pDHflrP6sw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1676464553; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nBVOWopFYGuyoJZZo7su/oJYSyPKj4iph+gUYVuAS1s=; b=so2kUUFPojoj+4IwX3VEMLSLJq2LFsjuroXPcWkfcEZwKYjCuGY9ESA3/axNtZt7u/97Vr XoCAr2vlTjUc/ACw== Received: from hawking.suse.de (unknown [10.168.4.11]) by relay2.suse.de (Postfix) with ESMTP id 6856D2C141; Wed, 15 Feb 2023 12:35:53 +0000 (UTC) Received: by hawking.suse.de (Postfix, from userid 17005) id 0F77A442F00; Wed, 15 Feb 2023 13:35:52 +0100 (CET) From: Andreas Schwab To: Stas Sergeev via Libc-alpha Cc: Stas Sergeev Subject: Re: [PATCH 1/2] elf: strdup() l_name if no realname [BZ #30100] References: <20230215112110.2426646-1-stsp2@yandex.ru> <20230215112110.2426646-2-stsp2@yandex.ru> X-Yow: Now I can join WEIGHT WATCHERS! Date: Wed, 15 Feb 2023 13:35:52 +0100 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") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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."