mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-09-13 16:44:57 +08:00
Fix codeql errors (#1181)
This commit is contained in:
parent
80e7f0adb0
commit
4b68e14039
2 changed files with 4 additions and 7 deletions
|
@ -4,7 +4,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -89,12 +88,10 @@ func ipMatchesClasslessDomain(ip net.IP, domain string) bool {
|
||||||
|
|
||||||
// atob converts a to a byte value or panics.
|
// atob converts a to a byte value or panics.
|
||||||
func atob(s string) uint8 {
|
func atob(s string) uint8 {
|
||||||
if i, err := strconv.Atoi(s); err == nil {
|
if i, err := ParseUint(s, 10, 8); err == nil {
|
||||||
if i < 256 {
|
return byte(i)
|
||||||
return byte(i)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
panic(fmt.Sprintf("(%v) matched \\d{1,3} but is not a byte", s))
|
panic(fmt.Sprintf("%v is not a byte", s))
|
||||||
}
|
}
|
||||||
|
|
||||||
func ipv6magic(name, domain string) (string, error) {
|
func ipv6magic(name, domain string) (string, error) {
|
||||||
|
|
|
@ -86,7 +86,7 @@ func decodeRecordDataNaptr(s string) models.RecordConfig {
|
||||||
// eatUint16 consumes the first 16 bits of the string, returns it as a
|
// eatUint16 consumes the first 16 bits of the string, returns it as a
|
||||||
// uint16, and returns the remaining bytes of the string.
|
// uint16, and returns the remaining bytes of the string.
|
||||||
func eatUint16(s string) (string, uint16) {
|
func eatUint16(s string) (string, uint16) {
|
||||||
value, err := strconv.ParseUint(s[2:4]+s[0:2], 16, 64)
|
value, err := strconv.ParseUint(s[2:4]+s[0:2], 16, 16)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue