summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2005-12-31 09:06:45 +0000
committerjmallett <jmallett@FreeBSD.org>2005-12-31 09:06:45 +0000
commit0a2aecae2cc43c02c9a84111afd3f3a7dbb11568 (patch)
tree80bc580bf3d44dffe0d6ad845dafccd65841c57d /usr.bin
parent8db1bd7411a1a4c2f4b01d0a822a5ec62d2f9251 (diff)
downloadFreeBSD-src-0a2aecae2cc43c02c9a84111afd3f3a7dbb11568.zip
FreeBSD-src-0a2aecae2cc43c02c9a84111afd3f3a7dbb11568.tar.gz
Check the entire length of the current argument for the EOF string with -E,
but don't expect a proper ASCII string to exist right here right now, don't use strcmp(3) which checks for a NUL. As we're still building the argument up, the next character might be garbage. It would probably be just as safe to temporarily write a NUL there, but if we've reached the end of argument memory that might not be the best idea, I think. It's unclear. Doing it this way seems to meet the most with the original intent. PR: 85696 Prodded by: stefanf
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/xargs/xargs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c
index b4a8b83..58ac847 100644
--- a/usr.bin/xargs/xargs.c
+++ b/usr.bin/xargs/xargs.c
@@ -304,7 +304,7 @@ arg1: if (insingle || indouble)
errx(1, "unterminated quote");
arg2:
foundeof = *eofstr != '\0' &&
- strcmp(argp, eofstr) == 0;
+ strncmp(argp, eofstr, p - argp) == 0;
/* Do not make empty args unless they are quoted */
if ((argp != p || wasquoted) && !foundeof) {
OpenPOWER on IntegriCloud