aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGravatar Yong Tang <yong.tang.github@outlook.com> 2022-02-07 06:09:12 -0800
committerGravatar GitHub <noreply@github.com> 2022-02-07 09:09:12 -0500
commit041e1eabc6022cba5e59a8b99d4226dea2bc4b0a (patch)
treed911c05dd77d4c57c0c11f87c48f9e5c018c196b /plugin
parent69473c5cad654f4b3a65aab4a7d1cc35ea5d5fa6 (diff)
downloadcoredns-041e1eabc6022cba5e59a8b99d4226dea2bc4b0a.tar.gz
coredns-041e1eabc6022cba5e59a8b99d4226dea2bc4b0a.tar.zst
coredns-041e1eabc6022cba5e59a8b99d4226dea2bc4b0a.zip
Fix a couple of code scanning alerts (#5157)
This PR fixed a couple of code scanning alerts: Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to 'plugin')
-rw-r--r--plugin/forward/setup.go5
-rw-r--r--plugin/whoami/whoami.go2
2 files changed, 2 insertions, 5 deletions
diff --git a/plugin/forward/setup.go b/plugin/forward/setup.go
index 1f88daba5..8bd1e1ff4 100644
--- a/plugin/forward/setup.go
+++ b/plugin/forward/setup.go
@@ -163,13 +163,10 @@ func parseBlock(c *caddy.Controller, f *Forward) error {
if !c.NextArg() {
return c.ArgErr()
}
- n, err := strconv.Atoi(c.Val())
+ n, err := strconv.ParseUint(c.Val(), 10, 32)
if err != nil {
return err
}
- if n < 0 {
- return fmt.Errorf("max_fails can't be negative: %d", n)
- }
f.maxfails = uint32(n)
case "health_check":
if !c.NextArg() {
diff --git a/plugin/whoami/whoami.go b/plugin/whoami/whoami.go
index fffc3be37..b46736c91 100644
--- a/plugin/whoami/whoami.go
+++ b/plugin/whoami/whoami.go
@@ -45,7 +45,7 @@ func (wh Whoami) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
if state.QName() == "." {
srv.Hdr.Name = "_" + state.Proto() + state.QName()
}
- port, _ := strconv.Atoi(state.Port())
+ port, _ := strconv.ParseUint(state.Port(), 10, 16)
srv.Port = uint16(port)
srv.Target = "."