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
This commit is contained in:
parent
571e4e6285
commit
4aeb63826e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=153934
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user