diff options
author | yar <yar@FreeBSD.org> | 2007-04-02 06:47:48 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2007-04-02 06:47:48 +0000 |
commit | 50830d7bd97af249cba7e1b2c85ae76c302bc1f8 (patch) | |
tree | ae47092520347c6631637c7376746d86240fc61e /usr.bin/sed/process.c | |
parent | fe291bbbabdf0f3631095e86d8def11db8fee524 (diff) | |
download | FreeBSD-src-50830d7bd97af249cba7e1b2c85ae76c302bc1f8.zip FreeBSD-src-50830d7bd97af249cba7e1b2c85ae76c302bc1f8.tar.gz |
Prevent foot-shooting in advance: Put the MATCH() macro's value
in parentheses. The ?: operator has a remarkably low precedence, so
expressions like (MATCH(foo) && bar) would have an unexpected meaning
w/o the parentheses around MATCH().
Tested with: md5(1)
Diffstat (limited to 'usr.bin/sed/process.c')
-rw-r--r-- | usr.bin/sed/process.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c index ee9334c..c609908 100644 --- a/usr.bin/sed/process.c +++ b/usr.bin/sed/process.c @@ -264,9 +264,9 @@ new: if (!nflag && !pd) * TRUE if the address passed matches the current program state * (lastline, linenumber, ps). */ -#define MATCH(a) \ - (a)->type == AT_RE ? regexec_e((a)->u.r, ps, 0, 1, psl) : \ - (a)->type == AT_LINE ? linenum == (a)->u.l : lastline() +#define MATCH(a) \ + ((a)->type == AT_RE ? regexec_e((a)->u.r, ps, 0, 1, psl) : \ + (a)->type == AT_LINE ? linenum == (a)->u.l : lastline()) /* * Return TRUE if the command applies to the current line. Sets the inrange |