From nobody Thu Jun 08 01:06:18 2023 X-Original-To: dev-commits-src-main@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 4Qc5d62J6yz4c0h2; Thu, 8 Jun 2023 01:06:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qc5d61gnTz3kYq; Thu, 8 Jun 2023 01:06:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686186378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VlL03gOBO/p7CbqznPitxHlGFQ9SRS6cH99fwqpTf7s=; b=fQ4mB+EwYI1c84x68R2gi7C7TwT2k8tQ3RmN0jHz6yRUtbMMNF0NqOBYcrDbaLnPIEWdTT BTTvn5ezo6SrctBde4xL44puwsZTJ0cvW1JHqZH3nTfP8BRS7iL9M3faYDHuIRhLtBh2vT 8oEd759PkoQXlNaUHyxL/uFFVGDnl6p3Bzj3RiNMR08Z+N/fDTbYhsqBPyayCW/VbSSkP4 g6CvYDjZaRjEkZ7CwP/sGa62CaWjHCz4rrkIKuJGuGo14JO7ZdONHD4L2xKo6WqGQH6w+T TJ7VQgaZny/tGP1gxz+PJSYtsgIgPp+xUstBu+t6DLVqHtZmZw2cyAY2NuN1LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686186378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VlL03gOBO/p7CbqznPitxHlGFQ9SRS6cH99fwqpTf7s=; b=ELVEL4fRc6Vk+TM4ENA79UdaLVxo+EpJWae41M1zgNxtsRUp1bkyr2ngaenC+IB3924B4t 4U96IPyOxenS66nR4augQFz3gex4s4dBShx9LBiWLElEa48F0kHsEJguVESH9hpwi+F/0h ziU8INlrpOdZ0sqpDFpQyOqmaugimhY1tcbuGMLNvx4FIOfSpPKsxSh6aM0Re/57uDnVHS 0LTchcj+UH4eI9uoHwq0L2oE+Q+jqDNVIDnNyxUG+O6x9CTvpPGOu2ySVTJrcgv7T17NNa +wZZZJMMqxV8edG5bNWlZihEemhF9/2MrxA1gNMo8R1/sNsuhXr9M2Op74/PPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686186378; a=rsa-sha256; cv=none; b=TCOO4jfLxCD38Nf9fb2nBVhFoD6tvg6HLUuK3DVx4ci68SzU2U7hjhe8qo2jtIUwCBmCLM CKQCj1x9B7ZgmjYbm4lYeeN/SyCxXEeRrUpcyhdcRyKtTbErknPk4umgKNrRf870GSAN5U 0RHUVLIcSFjg3S/jGFF6KMI9M+1jzLiEcke1oujax880QenkRASJsAI9K1wQh1lU5cXAUC qvATTOqBu5hD/ufCAX5KIOTp26EoFw7uwmsA9sV7B8o2PT/spt06Co7LNWnO9FgT8XHHde 6b5MPkxLHz2pnIoJ1Fr9Zh2RqAINV3C6NxsuweTTaUFWiqvnGEMlR7kkSRe9kQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Qc5d60kf4zZ3h; Thu, 8 Jun 2023 01:06:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35816IUt030757; Thu, 8 Jun 2023 01:06:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35816I1F030756; Thu, 8 Jun 2023 01:06:18 GMT (envelope-from git) Date: Thu, 8 Jun 2023 01:06:18 GMT Message-Id: <202306080106.35816I1F030756@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 1232c7884d4a - main - od(1): Fix skip value handling List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1232c7884d4a9bc69d4dd71cd293f92bb1ae6197 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=1232c7884d4a9bc69d4dd71cd293f92bb1ae6197 commit 1232c7884d4a9bc69d4dd71cd293f92bb1ae6197 Author: Xin LI AuthorDate: 2023-06-08 01:06:07 +0000 Commit: Xin LI CommitDate: 2023-06-08 01:06:07 +0000 od(1): Fix skip value handling POSIX defines -j as the number of bytes that od(1) should skip over the concatenated input files. The existing code tries to implement this behavior by checking if the current address was smaller than the skip value. However, this is not correct, because we adjust both the skip value and the address at the same time when we do fseeko (when file is seekable) or getchar (when file is not seekable). This commit fixes the problem by expecting the skip value to be zero upon return of next(). If the condition is not satisfied, a diagnostic message will be issued. Reported-by: Mohamed Akram Reviewed-by: emaste PR: 271832 MFC-after: 2 weeks Differential Revision: https://reviews.freebsd.org/D40446 --- usr.bin/hexdump/display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c index cad548e1ec41..36306ededfc6 100644 --- a/usr.bin/hexdump/display.c +++ b/usr.bin/hexdump/display.c @@ -263,7 +263,7 @@ get(void) * block and set the end flag. */ if (!length || (ateof && !next((char **)NULL))) { - if (odmode && address < skip) + if (odmode && skip > 0) errx(1, "cannot skip past end of input"); if (need == blocksize) return((u_char *)NULL);