From nobody Sun Feb 06 15:41:31 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7FD7519B426B for ; Sun, 6 Feb 2022 15:41:39 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JsD5t3C7gz4Stx for ; Sun, 6 Feb 2022 15:41:38 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qv1-xf2a.google.com with SMTP id a19so2832080qvm.4 for ; Sun, 06 Feb 2022 07:41:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=GWae2rO113ZsCENk1Ou8a9Z7+QDdbrnCgwRM7X5s0SM=; b=W2lcbUVvrnUCZBwBYf4bOVBjUbc87AHn6UA/7/pEgWGmEilK5zKgfdL7lVzhuRWhOl 6CnlzqJMi1o4J+X9s1/MZhBuC623mH9asZYjcfMXeCJxWZbywy6H7+dyr+/t3piQBqKO rwHy6hq0eRidLwdCY8CvS5nS7B7T4V/lEMc9XQhZBkeG9UHRx6kacXZbR7q92JKI7m36 shTT1sIkzqkWYI1NODR3HAQLPv+/V1APbzeO9gVyXDgyiGCK62s4IELL6KbYfpGgtYm9 tK51OQuTjZGHu9RCl3pYiEPpWfX1E0J5shDpBdU13HETd7rSSIST+mOj4EpgXEyHupit ee8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=GWae2rO113ZsCENk1Ou8a9Z7+QDdbrnCgwRM7X5s0SM=; b=Ko5sitZh/x1BMKe9fQhElaCXw144OOJLhbcImXAGAPaVRLrufcfVFGiP0wekGdLBZk oOUsTlFUSb59CMr6PBvgAUErFTbNz9bVIlAvcJzARZcjKOPJp0fKXMmetykIp8iugXex E9lv0d52uo4xeVxRrI3M7xmsvVLspwoGdsZZJtdp8p0k3DKwBbTgk5L3StTqk6PljQnZ V0EpuUlX/nzvb9zwsgvTkJkXAQRPvA2uu3fetfDKFnxdGXXzSm3hwWjnOYKCfSITYDo9 eRV1JErOXwA/BOCdf/u4DaOPgKVCObFdmmOxSzhcSeqikRi1m/o3VYNba6gssZ/DeFUA XhLg== X-Gm-Message-State: AOAM530QPrHKqs67M0k+OAQVs/znCGRTp+mnyubh1yXe5iqd2778LfG0 4UM3biWl+0CnyTutZyjMpe5ArA== X-Google-Smtp-Source: ABdhPJwkq3ZbvU3cNq6biHm76QaXLZysUoZWpIYR3s6E+LwM2vM6EUuzjG82jVSKi9H+6/BG64EnEw== X-Received: by 2002:a05:6214:2386:: with SMTP id fw6mr7688412qvb.89.1644162092547; Sun, 06 Feb 2022 07:41:32 -0800 (PST) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id f16sm4643753qtk.8.2022.02.06.07.41.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 07:41:32 -0800 (PST) Date: Sun, 6 Feb 2022 10:41:31 -0500 From: Shawn Webb To: Dimitry Andric Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: e17fede8ff46 - main - Fix too small sscanf output buffers in kbdmap Message-ID: <20220206154131.ym3wthb4jby4jz25@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202202061526.216FQ0uH082668@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kaoezzxq67p6ovag" Content-Disposition: inline In-Reply-To: <202202061526.216FQ0uH082668@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4JsD5t3C7gz4Stx X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=W2lcbUVv; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::f2a as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org X-Spamd-Result: default: False [-5.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-1.00)[-0.998]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::f2a:from]; MLMMJ_DEST(0.00)[dev-commits-src-all]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[100.16.224.136:received] X-ThisMailContainsUnwantedMimeParts: N --kaoezzxq67p6ovag Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Feb 06, 2022 at 03:26:00PM +0000, Dimitry Andric wrote: > The branch main has been updated by dim: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3De17fede8ff4629b5ff640ed660= 940b04c70da0b6 >=20 > commit e17fede8ff4629b5ff640ed660940b04c70da0b6 > Author: Dimitry Andric > AuthorDate: 2022-02-06 15:25:11 +0000 > Commit: Dimitry Andric > CommitDate: 2022-02-06 15:25:25 +0000 >=20 > Fix too small sscanf output buffers in kbdmap > =20 > This fixes the following warnings from clang 14: > =20 > usr.sbin/kbdmap/kbdmap.c:241:16: error: 'sscanf' may overflow; destin= ation buffer in argument 5 has size 20, but the corresponding specifier may= require size 21 [-Werror,-Wfortify-source] > &a, &b, buf); > ^ > usr.sbin/kbdmap/kbdmap.c:615:8: error: 'sscanf' may overflow; destina= tion buffer in argument 3 has size 64, but the corresponding specifier may = require size 65 [-Werror,-Wfortify-source] > keym, lng, desc); > ^ > usr.sbin/kbdmap/kbdmap.c:615:14: error: 'sscanf' may overflow; destin= ation buffer in argument 4 has size 64, but the corresponding specifier may= require size 65 [-Werror,-Wfortify-source] > keym, lng, desc); > ^ > usr.sbin/kbdmap/kbdmap.c:615:19: error: 'sscanf' may overflow; destin= ation buffer in argument 5 has size 256, but the corresponding specifier ma= y require size 257 [-Werror,-Wfortify-source] > keym, lng, desc); > ^ > =20 > In each case, the buffer being sscanf'd into is one byte too small. > =20 > MFC after: 3 days > --- > usr.sbin/kbdmap/kbdmap.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/usr.sbin/kbdmap/kbdmap.c b/usr.sbin/kbdmap/kbdmap.c > index a11956b682ee..0702c1e66e94 100644 > --- a/usr.sbin/kbdmap/kbdmap.c > +++ b/usr.sbin/kbdmap/kbdmap.c > @@ -225,7 +225,7 @@ get_extension(const char *name) > static char * > get_font(void) > { > - char line[256], buf[20]; > + char line[256], buf[21]; > char *fnt =3D NULL; > =20 > FILE *fp =3D fopen(sysconfig, "r"); > @@ -566,7 +566,7 @@ menu_read(void) > char *p; > int mark, num_keymaps, items, i; > char buffer[256], filename[PATH_MAX]; > - char keym[64], lng[64], desc[256]; > + char keym[65], lng[65], desc[257]; > char dialect[64], lang_abk[64]; > struct keymap *km; > struct keymap **km_sorted; >=20 Hey Dimitry, Would commits like this and d310bf3867b4168e57365196c3a31797c0538097 normally cause SAs? Off-by-one bugs are typically considered security bugs. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --kaoezzxq67p6ovag Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmH/7CkACgkQ/y5nonf4 4fo88xAAjugbPBiBYxFLKU5aehVPKtFALlN9AtNS0H0wcRTLO1+2sTwtfWhFpY/N p5aFK/OGSmdZYe4740RhKDj2CpN3O5YYDMDy3VSRR8PvDZyV44bTiS4yvKjnKCTq sXOhrmaXZcSAnZzEZt806TbIiS9MgE9dIpXhAexmg7oQXuR1mtctiYvdMebhsu4Y 4CT0xzLKkZibbxpCd5ab/MleslpU2H9f3lImXpVgAJ8nee/58oOlh4fVHZafFTUn ybVcKk23jDpY+xX8xuNjyJm6kmJpSNgvYbCYh/N8psv514LFPyP/qY6TpeAtO7Io gkiH6BIVkn0wyqpvURVShCcc2gfOpFQEe5uoeSFM9FDJnEbkUmxxLYcQT1Os/ywc p6BEYDMb0h64Cmr/17JjIOjXTUmjAG6fHAH7eYD+v1eUWqGgLUxlMx7h1/7wKlY4 HP+9/8jg8zMkAFsFWPp0vZnltnGZIm1O4NDy9jTbJY9CcBox/4ELRfqeUbjh6OfX 5a1ntRDbDuqetqVM3usfYGFbO2dDXQY/qusxhSUu7sIk61JrKgN+0wYcaBV9ppKe UPoFrp0HiXBKbhHNFbd4Vm2GfkjPw0+TjzGibOufjFb8L/Rt8E1x+wKYgxVes4oP NF3oCdWcxjqclYPuzReralGQZc/He9mTcJYJ4tnXG3DS9IYrWIM= =enuN -----END PGP SIGNATURE----- --kaoezzxq67p6ovag--