Message ID | 20200112120216.18.I6168badb553fa92db60d2539b78087eac6dfc68e@changeid |
---|---|
State | Superseded |
Delegated to: | Simon Glass |
Headers | show
Return-Path: <u-boot-bounces@lists.denx.de> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=jH/nHfnk; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47wmWS03bQz9s4Y for <incoming@patchwork.ozlabs.org>; Mon, 13 Jan 2020 06:10:11 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B70D081812; Sun, 12 Jan 2020 20:07:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="jH/nHfnk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D71E5817EA; Sun, 12 Jan 2020 20:07:25 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B610080E80 for <u-boot@lists.denx.de>; Sun, 12 Jan 2020 20:07:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd44.google.com with SMTP id z193so7293187iof.1 for <u-boot@lists.denx.de>; Sun, 12 Jan 2020 11:07:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XePbMqDh2DJ1L9vTE/O0Bwdr7QD1l8GTIHz72CAAY7k=; b=jH/nHfnkfC78VR+LhejSo8zVcf28S9dbnWKv3biGorogCd0zZiSaajtNSpDQjQ013M pwn/Z3r/JWZD2cUrq03veGH4/F5K7Ffx5s7CUvHgSh5FCfUM1ljoYvn31isVpwG0nTuP gtYULVdBrSQuJtat/oVULxm8svbh8yBqPnmkM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XePbMqDh2DJ1L9vTE/O0Bwdr7QD1l8GTIHz72CAAY7k=; b=qXWBg0OMwY3nt4gPAqQUSAKOITrZURd2rxVXs1DIuRCaJ54jpRccVr+cbScX2Qivv/ OeVMSS+m0b1ceQuP1PC3WvEbNzvn+bwkETMfbRlDhBsOf29/XuB1lIASBS6zQqZHR9GK oDoHsEqfNVWtcqAD4s1UM8c8AbeobKJtjzFbSGBtnRAQYFTfv9uBe35HPybRghugGpgp 0MGrkCK+9CoJJc+Kg4CIXPcD65MXx+9uPUW5ifZujWtt2M5muKtmipvaKNbOIXbra+wz F0S6cIToiMDO7S0k6HMa/ArKvBu5VILz3ftrPZk8SVir35xaaXHcXCUulMaIfo6jxAwJ ti8A== X-Gm-Message-State: APjAAAV1ZsWT9ES+jKfgUPAHopHaJR5bpy/ZdUMjcBaknQ0oPy3IdWh2 RRP9N+6q0+n2yGedgt396e69pueiNKM= X-Google-Smtp-Source: APXvYqwZ7ItDwq4vDC1wEq9gNVR07HSYAjPNAykF1H7u18Y3uIhGdj8S3u3H6ArNCWNcQdYiHLUcTA== X-Received: by 2002:a02:6515:: with SMTP id u21mr11146166jab.82.1578856041619; Sun, 12 Jan 2020 11:07:21 -0800 (PST) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id r22sm3039219ilb.25.2020.01.12.11.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jan 2020 11:07:21 -0800 (PST) From: Simon Glass <sjg@chromium.org> To: U-Boot Mailing List <u-boot@lists.denx.de> Subject: [PATCH 18/33] sandbox: Ensure that long-options array is terminated Date: Sun, 12 Jan 2020 12:06:09 -0700 Message-Id: <20200112120216.18.I6168badb553fa92db60d2539b78087eac6dfc68e@changeid> X-Mailer: git-send-email 2.25.0.rc1.283.g88dfdc4193-goog In-Reply-To: <20200112190624.79077-1-sjg@chromium.org> References: <20200112190624.79077-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean |
Series |
sandbox: Move to SDL2
|
expand
|
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 60011f7abc..f7c73e3a0b 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -284,7 +284,7 @@ int os_parse_args(struct sandbox_state *state, int argc, char *argv[]) /* dynamically construct the arguments to the system getopt_long */ short_opts = malloc(sizeof(*short_opts) * num_options * 2 + 1); - long_opts = malloc(sizeof(*long_opts) * num_options); + long_opts = malloc(sizeof(*long_opts) * (num_options + 1)); if (!short_opts || !long_opts) return 1; @@ -314,6 +314,7 @@ int os_parse_args(struct sandbox_state *state, int argc, char *argv[]) /* we need to handle output ourselves since u-boot provides printf */ opterr = 0; + memset(&long_opts[num_options], '\0', sizeof(*long_opts)); /* * walk all of the options the user gave us on the command line, * figure out what u-boot option structure they belong to (via
The last member of this array is supposed to be all zeroes according to the getopt_long() man page. Fix the function to do this. Signed-off-by: Simon Glass <sjg@chromium.org> --- arch/sandbox/cpu/os.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)