Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFzJB-00D5KP-US for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Dec 2023 16:20:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rFzJA-00EXWT-JQ for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Dec 2023 16:20:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFzJA-00EXVy-A5 for pgsql-hackers@lists.postgresql.org; Wed, 20 Dec 2023 16:20:32 +0000 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rFzJ7-00BMA1-R8 for pgsql-hackers@lists.postgresql.org; Wed, 20 Dec 2023 16:20:31 +0000 Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-35d57e88c1dso26575485ab.2 for ; Wed, 20 Dec 2023 08:20:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703089229; x=1703694029; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=JLBiz0gRCReyqJfdj0z4JP4q8fjsB5Z2kYtpOSwYjNs=; b=fEGmI4yLHE8Nim9wtvRNqE/MR3lpHPxpAviLSdyQifTz9rQOtDnq9FJr+64luqBKvT flnveOZHR6ftLm3gyLo+If1cSQyR2b7MgEoiSPAvxql9u73kEmbKOoyVpfdp4sKZo8B6 JJ8ZnIGfmCT67dlCi44mWJYZ73hdPi8gTjq+QzmK5pjHSbvh7UxbcXNLxp5jWXP3hOyD YlVmkLavDBnAVj0+IhZExojTjNFVFUVzyYRYfmMKffQKKYkWgtBk+K7SZdt4xW6dg0g8 vB+6P+lalGNeCjmqRA7WfTcBwhq41iZhDP8HcXHaV9PuD1n/Pj2dJZRGdejnrkzNaKAZ WYRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703089229; x=1703694029; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JLBiz0gRCReyqJfdj0z4JP4q8fjsB5Z2kYtpOSwYjNs=; b=b9LzrqHgCFwggrN4wbFtP1lmzmet+XQg+juDlfhk9UcjpTqXO7R8t+lQz86V7VrE1I VLZNHGa8w/LMHZXAYYlnoSx+kL+ltAMMoSly9/FbeIskSGoAzqW7LKwSHGqhIl2dYcXB IlTrmj/ENoMbekd42XOHn8J7yAYhOsP7UP2u9f/fp1B7/BUsSPlPaQSIjFm9Pm5qcydO odCEObeYB22pbDfyUHJ9DRO5UfJBBMR3J85aXW7exdaUVi2+s1qVhuqSuh7eTNF+XWOC WgqLoTzVnXCOF0ShFIqJ+gCdlwRETXgyhk2Nd7KLsV0o3hHCRLRSN8R/J1r0cmjVmc/4 EsWA== X-Gm-Message-State: AOJu0YwAVJ+HMO8GSoajZhq2U5fy+UaRxqJhKTv2AV9KeFvITedPy/ie j3tOvq5WXb14W8QjbsN4sxQ= X-Google-Smtp-Source: AGHT+IGNk4u4pZUGp08x9nQJCLxvinbPjMmYbIU7Cv3Ky3Xh8OwQhJPCYAr5bF6vD8lcLVLBRB8YEw== X-Received: by 2002:a05:6e02:12c4:b0:35f:b33b:cb97 with SMTP id i4-20020a056e0212c400b0035fb33bcb97mr5826764ilm.39.1703089228185; Wed, 20 Dec 2023 08:20:28 -0800 (PST) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id k2-20020a92c242000000b0035fc2cd7a94sm886302ilo.62.2023.12.20.08.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 08:20:27 -0800 (PST) Date: Wed, 20 Dec 2023 10:20:26 -0600 From: Nathan Bossart To: Tristan Partin Cc: Daniel Gustafsson , Postgres hackers Subject: Re: Unchecked strdup leading to segfault in pg_dump Message-ID: <20231220162026.GD833819@nathanxps13> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Dec 20, 2023 at 09:39:55AM -0600, Tristan Partin wrote: > On Wed Dec 20, 2023 at 8:52 AM CST, Daniel Gustafsson wrote: >> While looking at something else I noticed that pg_dump performs strdup without >> checking the returned pointer, which will segfault in hasSuffix() in case of >> OOM. The attached, which should be backpatched to 16, changes to using >> pg_strdup instead which handles it. > > Looks good to me. +1 -- Nathan Bossart Amazon Web Services: https://aws.amazon.com