Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 1be34c0

Browse files
authored
Merge pull request #359 from smowton/smowton/fix/suspicious-regex-qhelp
Improve variable names in example code
2 parents 3490d35 + 1cfad84 commit 1be34c0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ql/src/Security/CWE-020/SuspiciousCharacterInRegexp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package main
33
import "regexp"
44

55
func broken(hostNames []byte) string {
6-
var htmlRe = regexp.MustCompile("\bforbidden.host.org")
7-
if htmlRe.Match(hostNames) {
6+
var hostRe = regexp.MustCompile("\bforbidden.host.org")
7+
if hostRe.Match(hostNames) {
88
return "Must not target forbidden.host.org"
99
} else {
1010
// This will be reached even if hostNames is exactly "forbidden.host.org",

ql/src/Security/CWE-020/SuspiciousCharacterInRegexpGood.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package main
33
import "regexp"
44

55
func fixed(hostNames []byte) string {
6-
var htmlRe = regexp.MustCompile("\\bforbidden.host.org")
7-
if htmlRe.Match(hostNames) {
6+
var hostRe = regexp.MustCompile("\\bforbidden.host.org")
7+
if hostRe.Match(hostNames) {
88
return "Must not target forbidden.host.org"
99
} else {
1010
// hostNames definitely doesn't contain a word "forbidden.host.org", as "\\b"

0 commit comments

Comments
 (0)