Message ID | 20221103012411.86537-1-Jason@zx2c4.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp251195wru; Wed, 2 Nov 2022 18:28:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5uiKBTeYFSJSKyVe3iUVVXK8L0zWMpJZKtMN/Rka6lmnYUsOcdna+962TfGg7hCTYMpS8+ X-Received: by 2002:a17:907:8688:b0:791:91a0:fdb3 with SMTP id qa8-20020a170907868800b0079191a0fdb3mr25892330ejc.499.1667438919244; Wed, 02 Nov 2022 18:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667438919; cv=none; d=google.com; s=arc-20160816; b=oqZemDWaD3MhpZ4TnCrdV+CgcoBKPNN/4IZsM02+Qvkbq9Ctc3zvi3Y/VDbt4CSVeG Os4i0f39FjdmykZsa99wjH+xeJiUTPCrQYJlkr/y61SR+cUCsL7hulJ87sQmEClbe/9O WxVcX2oke0MUCSSYb1yKd0QR3YQWxt3E+wjbfqvi4W3PWyLPo1ieqasHVPCjjBw0siQE e2NJXFpNhFSA2SlFCkn5h8ZwS8epSRBv0jpOnfEu8IFdokUuSO/E5UcZlrJBNUrdmOgT Bs9MqP1zF50ZGXfrd1yIF5D6KnkECGy7EcFhaPExIFAFNf+I3rRLeYgJy/jzpKXg/idX OScQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=W7+oZClI0CrZlu6ZI88HJXSD2TxfHpWRCQjNVJlmR0w=; b=wGSdhOleL/dFaMLxr9TNn9Gg0WwzIYeav8Ks5UVXXvmDfhO9AZIZePjwqSAo7WSD94 eT0RLsT+834cq/9WWz++WvaHQfDD0pC1Bo2ItW/e0wYmYZViwQvJiwQK1PCaPdkUyB6G 6f4H4eCT91c3vMkrCeYvOeUKuzWkcOOUGhouFAJsxHGrTfa0eqkF5rpQT2rwnwrL5Od5 pG96m1cNo1mYs/R/1uwu8vbrDa0YDKNse9020z2OHr6QUHA0MoO55QQpCmPGeSJmlNDu TQ+nEvPkjuWNjuffNXDcgs1FErr6OzMpCR7hx2mUsA5pUCUEPWcnfKGyPaKGauf3PdHL zUZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=FWdiD5+j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l15-20020a170906794f00b007add6be8c86si15050071ejo.762.2022.11.02.18.28.16; Wed, 02 Nov 2022 18:28:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=FWdiD5+j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230159AbiKCBYc (ORCPT <rfc822;yves.mi.zy@gmail.com> + 99 others); Wed, 2 Nov 2022 21:24:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiKCBYa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 2 Nov 2022 21:24:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD76E62D7; Wed, 2 Nov 2022 18:24:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 490C961CE7; Thu, 3 Nov 2022 01:24:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DCB6C433C1; Thu, 3 Nov 2022 01:24:28 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="FWdiD5+j" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1667438665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=W7+oZClI0CrZlu6ZI88HJXSD2TxfHpWRCQjNVJlmR0w=; b=FWdiD5+jw7oC4pCzUniMPm1csJGA0WmlLbjPqHPbq33yv0oIZm3QBenwGHkFTGvuMbTqq7 g7SXUKCaAQ5HjNTivyC30UpnoGBCLU980bcJaw754nznkMIUEcyiVc9bu2feDeoJjuNXg9 9TkVsxlZroaQIP2X3N3imiOxFO7L4ow= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 1d66be06 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 3 Nov 2022 01:24:25 +0000 (UTC) From: "Jason A. Donenfeld" <Jason@zx2c4.com> To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, krisman@collabora.com Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>, stable@vger.kernel.org Subject: [PATCH] unicode: don't write -1 after NULL terminator Date: Thu, 3 Nov 2022 02:24:11 +0100 Message-Id: <20221103012411.86537-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748436432237365947?= X-GMAIL-MSGID: =?utf-8?q?1748436432237365947?= |
Series |
unicode: don't write -1 after NULL terminator
|
|
Commit Message
Jason A. Donenfeld
Nov. 3, 2022, 1:24 a.m. UTC
If the intention is to overwrite the first NULL with a -1, s[strlen(s)]
is the first NULL, not s[strlen(s)+1].
Cc: Gabriel Krisman Bertazi <krisman@collabora.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
fs/unicode/mkutf8data.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 03. 11. 22, 2:24, Jason A. Donenfeld wrote: > If the intention is to overwrite the first NULL with a -1, s[strlen(s)] > is the first NULL, not s[strlen(s)+1]. This caught my attention. You mix NULL (void *) with NUL (\0) in the changelog & subject. That occurs rather confusing to me. > Cc: Gabriel Krisman Bertazi <krisman@collabora.com> > Cc: stable@vger.kernel.org > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> > --- > fs/unicode/mkutf8data.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/unicode/mkutf8data.c b/fs/unicode/mkutf8data.c > index bc1a7c8b5c8d..61800e0d3226 100644 > --- a/fs/unicode/mkutf8data.c > +++ b/fs/unicode/mkutf8data.c > @@ -3194,7 +3194,7 @@ static int normalize_line(struct tree *tree) > /* Second test: length-limited string. */ > s = buf2; > /* Replace NUL with a value that will cause an error if seen. */ > - s[strlen(s) + 1] = -1; > + s[strlen(s)] = -1; > t = buf3; > if (utf8cursor(&u8c, tree, s)) > return -1;
diff --git a/fs/unicode/mkutf8data.c b/fs/unicode/mkutf8data.c index bc1a7c8b5c8d..61800e0d3226 100644 --- a/fs/unicode/mkutf8data.c +++ b/fs/unicode/mkutf8data.c @@ -3194,7 +3194,7 @@ static int normalize_line(struct tree *tree) /* Second test: length-limited string. */ s = buf2; /* Replace NUL with a value that will cause an error if seen. */ - s[strlen(s) + 1] = -1; + s[strlen(s)] = -1; t = buf3; if (utf8cursor(&u8c, tree, s)) return -1;