Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Apr 2023 16:17:13 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 270867] xargs -E is not working properly
Message-ID:  <bug-270867-227-sXrm60qKOk@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-270867-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270867

Yuri Pankov <yuripv@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yuripv@FreeBSD.org

--- Comment #1 from Yuri Pankov <yuripv@FreeBSD.org> ---
Apparently foundeof check is passing the wrong length to strncmp(), we should
be using the eofstr's one, not the current argument's:

diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c
index 21455e7be26..89f75a4c386 100644
--- a/usr.bin/xargs/xargs.c
+++ b/usr.bin/xargs/xargs.c
@@ -349,7 +349,7 @@ arg1:               if (insingle || indouble) {
                }
 arg2:
                foundeof = *eofstr != '\0' &&
-                   strncmp(argp, eofstr, p - argp) == 0;
+                   strncmp(argp, eofstr, strlen(eofstr)) == 0;

                /* Do not make empty args unless they are quoted */
                if ((argp != p || wasquoted) && !foundeof) {

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-270867-227-sXrm60qKOk>