From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham autolearn_force=no version=3.4.1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a54GMaSk/2xL8UAzvnP4MWJ7CUjO5EAoXFc6owTHkd7ikaO0t5xXGmN2ow6OEyX5Tzr1N7nSt05qp+53RnMZtSdXj8XFtyJsWJtsisbuwtG3eGTlgEnaKIE4icYN70Av7vv8q8DV4T1qk+OR9aGfKAjNl0sOippm+yRe4t5w6PoKOTD0pWjqKPLP/LmVR+StPNp5gVrxIIp4MJ6/oUd434RdEoEHFeFz6rrDhTUlTN3csdv8D9+a8CmpBmAW1ztbZ3/+ErWU/RYcLo5RgpPCqO1id0m/FUgvDoeJI4P8ORSVCX0ZBA2J/gVZn0C1Mrxl47QkxwjdFJP84f8MJFgG2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lPCuI1X+iXjrKzGNC1N3IU88/n6ORN4wZ9q8IAg2xl8=; b=ginhWXYGH7W/7JuBk78fXC5N0inpIVeywgQGSHf1iD+hQi2RUwnnZ1eIJsa7tj9xF2QhY1x/Pc61q1sXFyiEzR5kycvksBG0E5IytAxU5qdYFdCMctcgDWnvyjV+q9/2K+C0tCF3W6aG9kaYlkoJpoOLqF1UWfpt3Uws13xrKplzw2ZlNaqQfPcG+ySvn5IqnEFIZaMxQEyS4GVIE/Ii591hYbVuG7p+J3z9ni9gnYDzksD8PUlFHMHcFIfCoroZCx/q+Ke1fjgXKyqxriv2KZKDlxfCQOYM/W1yhnltn5s3w3NAVlgCrp8CF6GE4eR8pvHFXytgOlBwhybrCErDsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=urjc.es; dmarc=pass action=none header.from=urjc.es; dkim=pass header.d=urjc.es; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=urjc.onmicrosoft.com; s=selector2-urjc-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lPCuI1X+iXjrKzGNC1N3IU88/n6ORN4wZ9q8IAg2xl8=; b=XwaJIcff5l/JKeCYWdlf3xz+wrsXgW2N0CAUir3Yud15nxf8c4mLtLMOwR2KLSr/LeWR/LZmHlWh6NoDVTW2bn2fPH1GiO6tDy/8ZHjdA3wlovz+E4BKq4xW1IWhRS3Xf8rSzB7ckXfA1eZs3psliAYt4d+JDdQa9Zp4EXnR5fc= From: =?iso-8859-1?Q?Javier_Pello_Garc=EDa?= To: "kbd@lists.altlinux.org" Thread-Topic: [PATCH] libkeymap: Fix mk_mapname for the plain map Thread-Index: AQHVrE3xtjgqGR6lWk+WXHGl0AvD3A== Date: Fri, 6 Dec 2019 15:58:03 +0000 Message-ID: <20191206165759.81e4f6e3b62f22433ef27c65@urjc.es> Accept-Language: es-ES, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: ZRAP278CA0010.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::20) To DB7PR02MB3641.eurprd02.prod.outlook.com (2603:10a6:5:f::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=javier.pello@urjc.es; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) x-originating-ip: [212.128.1.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9f575db7-9bd1-4db0-e45d-08d77a65139d x-ms-traffictypediagnostic: DB7PR02MB4726: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 0243E5FD68 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(39850400004)(376002)(396003)(366004)(346002)(199004)(189003)(6486002)(316002)(99286004)(6512007)(66556008)(81166006)(8936002)(102836004)(786003)(86362001)(6916009)(8676002)(1076003)(50226002)(5640700003)(71200400001)(5660300002)(71190400001)(2616005)(81156014)(66476007)(52116002)(36756003)(64756008)(2906002)(186003)(478600001)(66446008)(305945005)(66946007)(1730700003)(6506007)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR02MB4726; H:DB7PR02MB3641.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: urjc.es does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MOnY1MH29dBAWKn/l/mSRxOHJy3G3tPqti7vAijhtLA5pDL0ZoDy1Hs9e6ylA+Uw1qQ1hP9glHozC8U6f/xMxz0ymGLPknFIHcFxHhmz2q51jT6m96M7mC6T16ljRR8ynKpW0OEjTFgV9qUXhC6UVIYYHtT9WvC5PH7WwG9RsFfM70jjpGfivOSMvQHe6xqFROm2UcSoGhmKMry3fNkgjKGZNvo00+K25wBwtfOKRG5rvtHuTP/WsHGayQybbY8vpd6xJNAxiyyPHZhJsF70ho7Yeq2WwMd+xQ7g4MYLVE2EMw1I76ZxdoBXacOpQSbPk7HHOnVhFrtzMq+X6+eZADsofeZ1k4f+odhU2yuMmFYJUSakVAAI61TI/TjhBwkzB9BtP+0lZUUFghtp4tdYp9CJACbnOLKnpEg6xcophw64lvJYIZYsmTgjHBd3evt2 x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: urjc.es X-MS-Exchange-CrossTenant-Network-Message-Id: 9f575db7-9bd1-4db0-e45d-08d77a65139d X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Dec 2019 15:58:03.6824 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5f84c4ea-370d-4b9e-830c-756f8bf1b51f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: NAFp3T6hP78xc7EOyL7YIPuIgcWQe4xPKYLOsf6id4+wlAM5vf1H3eM3luIbiiIgopqeiDmFcLOovoxUfrKXww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR02MB4726 X-Mailman-Approved-At: Sat, 07 Dec 2019 15:05:07 +0300 Subject: [kbd] [PATCH] libkeymap: Fix mk_mapname for the plain map X-BeenThere: kbd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Linux console tools development discussion List-Id: Linux console tools development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 15:58:11 -0000 Archived-At: List-Archive: mk_mapname did not correctly return "plain" for the plain map (no modifier set) if it had already been called, as it did not correctly reset the static buffer that it uses for the map name. When mk_mapname is called for the first time from the first loop in lk_dump_ctable, all is fine, since buf has not been used yet and it is initialised to 0. However, when it is called again for the plain map from the second loop in lk_dump_ctable, buf already contains a value (left over from the last iteration in the first loop), and then strcat appends "plain" to that value instead of overwriting it, resulting in a bogus value. Signed-off-by: Javier Pello --- src/libkeymap/dump.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libkeymap/dump.c b/src/libkeymap/dump.c index 8531b5aa..02c8eab4 100644 --- a/src/libkeymap/dump.c +++ b/src/libkeymap/dump.c @@ -91,7 +91,7 @@ fail: return -1; } =20 -static char * +static const char * mk_mapname(char modifier) { static const char *mods[8] =3D { @@ -100,10 +100,8 @@ mk_mapname(char modifier) static char buf[60]; int i; =20 - if (!modifier) { - strcat(buf, "plain"); - return buf; - } + if (!modifier) + return "plain"; buf[0] =3D 0; for (i =3D 0; i < 8; i++) if (modifier & (1 << i)) { --=20 2.23.0