@@ -1622,7 +1622,7 @@ func isAssignment(tok string) bool {
16221622 return false
16231623 }
16241624 for _ , r := range tok [:eq ] {
1625- if ! ( r == '_' || (r >= 'A' && r <= 'Z' ) || (r >= 'a' && r <= 'z' ) || (r >= '0' && r <= '9' ) ) {
1625+ if r != '_' && (r < 'A' || r > 'Z' ) && (r < 'a' || r > 'z' ) && (r < '0' || r > '9' ) {
16261626 return false
16271627 }
16281628 }
@@ -1912,9 +1912,10 @@ func isSystemWrite(first string, tokens []string) bool {
19121912}
19131913
19141914// chmodSetsSUIDGID reports whether a chmod invocation sets the setuid or setgid
1915- // bit, either symbolically (u+s, g+s, +s) or via an octal mode whose leading
1916- // special-permission digit includes 4 (setuid) or 2 (setgid) — e.g. 4755, 2755,
1917- // 6755. A plain 3- or 4-digit mode with a 0 special digit (0755) does not.
1915+ // bit, either symbolically (u+s, g+s, +s, u=rws, a=rwxs, …) or via an octal
1916+ // mode whose leading special-permission digit includes 4 (setuid) or 2
1917+ // (setgid) — e.g. 4755, 2755, 6755. A plain 3- or 4-digit mode with a 0
1918+ // special digit (0755) does not.
19181919//
19191920// Only the mode argument (the first non-flag operand) is inspected; trailing
19201921// tokens are filenames and must not trigger on an incidental "+...s" or octal
@@ -1924,13 +1925,19 @@ func chmodSetsSUIDGID(tokens []string) bool {
19241925 if strings .HasPrefix (tok , "-" ) {
19251926 continue // flag (e.g. -R, --recursive, --reference=FILE)
19261927 }
1927- // Symbolic: any clause that adds the 's' permission (u+s, g+s, a+s, +s,
1928- // ug+rs, …). We only care about additions, so look for "+...s".
1928+ // Symbolic: any clause that sets the 's' permission (u+s, g+s, a+s, +s,
1929+ // ug+rs, u=rws, a=rwxs, …). Both '+' (add) and '=' (set exactly) can
1930+ // introduce the setuid/setgid bit.
19291931 if plus := strings .IndexByte (tok , '+' ); plus >= 0 {
19301932 if strings .ContainsRune (tok [plus + 1 :], 's' ) {
19311933 return true
19321934 }
19331935 }
1936+ if eq := strings .IndexByte (tok , '=' ); eq >= 0 {
1937+ if strings .ContainsRune (tok [eq + 1 :], 's' ) {
1938+ return true
1939+ }
1940+ }
19341941 // Octal: a 4-digit mode whose first digit has bit 4 (setuid) or 2
19351942 // (setgid) set. 3-digit modes have no special-permission digit.
19361943 if len (tok ) == 4 && isOctalMode (tok ) {
0 commit comments