From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 4DlMNW5bIV+0ZAAA0tVLHw (envelope-from ) for ; Wed, 29 Jul 2020 11:20:14 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id kOomMW5bIV+cBAAAB5/wlQ (envelope-from ) for ; Wed, 29 Jul 2020 11:20:14 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 27BE89408FE for ; Wed, 29 Jul 2020 11:20:13 +0000 (UTC) Received: from localhost ([::1]:48788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0k83-0003hT-UE for larch@yhetil.org; Wed, 29 Jul 2020 07:20:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0k7u-0003h1-Qn for bug-guix@gnu.org; Wed, 29 Jul 2020 07:20:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48704) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k0k7u-0000a7-04 for bug-guix@gnu.org; Wed, 29 Jul 2020 07:20:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k0k7t-0003m9-SC for bug-guix@gnu.org; Wed, 29 Jul 2020 07:20:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#40832: alsa-lib cannot find its plugins Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 29 Jul 2020 11:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40832 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Leo Famulari Received: via spool by 40832-submit@debbugs.gnu.org id=B40832.159602154814448 (code B ref 40832); Wed, 29 Jul 2020 11:20:01 +0000 Received: (at 40832) by debbugs.gnu.org; 29 Jul 2020 11:19:08 +0000 Received: from localhost ([127.0.0.1]:60250 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k0k72-0003ky-LV for submit@debbugs.gnu.org; Wed, 29 Jul 2020 07:19:08 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:45846) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k0k70-0003kn-Q8 for 40832@debbugs.gnu.org; Wed, 29 Jul 2020 07:19:07 -0400 Received: from localhost (80-110-127-146.cgn.dynamic.surfer.at [80.110.127.146]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 0D44A3362155; Wed, 29 Jul 2020 13:19:05 +0200 (CEST) Date: Wed, 29 Jul 2020 13:18:44 +0200 From: Danny Milosavljevic Message-ID: <20200729131844.18b08be2@scratchpost.org> In-Reply-To: <20200728235623.GA1936@jasmine.lan> References: <20200424213727.GA11710@jasmine.lan> <20200728125241.4ff41418@scratchpost.org> <20200728235623.GA1936@jasmine.lan> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/rhLah9rhqC6sPImVcJOZc+C"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.7 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 40832@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 0.39 X-TUID: KpuOS8gfjNCU --Sig_/rhLah9rhqC6sPImVcJOZc+C Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Leo, On Tue, 28 Jul 2020 19:56:23 -0400 Leo Famulari wrote: > On Tue, Jul 28, 2020 at 12:52:41PM +0200, Danny Milosavljevic wrote: > > some comments on the lastest patch: =20 >=20 > Thank you for reviewing the patch! >=20 > > * The entire alsa-lib seems to use the idiom "malloc and then strcpy", = or > > "malloc and then sprintf", or, worse, "malloc, strcpy and multiple strc= at". > > These are a buffer overflow waiting to happen (when changing part of th= ose > > while doing ongoing maintenance; also the places where they use "+" is= not > > checked for overflow). That said, if they do it, we can do it that way= , too. =20 >=20 > This confirms what I felt =E2=80=94 it's hard to feel confident about the= bounds > checking in this code. It seems to be based on the names of the plugin > libraries not exceeding some magic length. It's hard to balance "doing > the right thing" and using upstream's idioms. After thinking about it more, I think it's much worse if the thing that is stuck into the malloced block is the value of an environment variable. When it's a compile-time variable you basically trust the code and the distribution package not to have too-long paths in there that could overflow the "+" in malloc(... + ). A distribution or upstream could do much worse things than that, so that is not a credible threat to worry about. For a runtime variable like the environment variable (that anyone can set to anything), I am very much in favor of not using malloc(... + ) and instead using asprintf, in order to prevent an exploitable buffer overflow just by setting up an environment variable. > When writing the patch, my investigation into the code made decide that > it would not overflow, but now I don't remember why I thought that. Thanks for that remark. It made me think and I came to the recommendation above. --Sig_/rhLah9rhqC6sPImVcJOZc+C Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl8hWxQACgkQ5xo1VCww uqU6ggf9GepLAqJmnyYpilvAyGOkD4AC1Fj+V7d8EuNqjAOsFmO+3pHaECHAJBne DKo7h6NL4ynsR+OfPoc/O6zIsFoOjiUVqHX8HpUZCOCvrl7lPyPyoFJOOGChNcXh x1lkj8bOnaW2uLPpZ2wL5ff3R/k2geqDWha6rEREs/rKgxLswgNOWownozpfYH7M PVJAqIgggp2FeZ7+Glm2YfFdDrJdz9vgFthk3bhyMCbI41FVPiEu3Iwmq2SQlkGP pR+ae8tbFkk8Acn8I71F+Pyj/yU+S+nyaHVHR9AK2y3uvsZYKyy6cAw8g8cIFeBF dt1W6Zh3MRxGj9onS1VPP/iBy73Iag== =cqCo -----END PGP SIGNATURE----- --Sig_/rhLah9rhqC6sPImVcJOZc+C--