Commit Graph

16 Commits

Author SHA1 Message Date
Josh Soref 883641f4a9
Spelling (#1222)
* spelling: artifacts

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: encoding

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: exponent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: ignoring

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: implemented

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: implements

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: next

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: numeric

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: previous

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: positions

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: presentation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: resetting

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: stringifying

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: subsequent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: validated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Miek Gieben <miek@miek.nl>
2021-02-25 17:08:05 +01:00
Miek Gieben 4d4363a5dc
build: reduce testing output (#1031)
Use a better name in the fuzzing test to not spam the travis output,
move to Go 1.13.x in travis.yaml

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-20 07:12:43 +01:00
Miek Gieben 997f079b75
Run gofmt (#1024)
Periodic go-fmt-ing.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-07 10:33:11 +01:00
chantra 557870346a [scan] fix crashers when parsing comment (#1018)
* [scan] fix crashers when parsing comment

When dealing with comments the parsers was potentially incrementing comi
variable twice. During the second access to com[], comi was possibly
longer than maxTok, causing an out of bound error:
panic: runtime error: index out of range [2048] with length 2048

* * Keep only 1 crasher test string.
* move tests from scan_test.go to fuzz_test.go
2019-10-03 19:09:39 +01:00
chantra ccd41ffaf8 [nsec3] fix crash in nsec3 packing (#973)
Both NSEC and NSEC3 use the same logic to pack the bitmap.
CSYNC.pack also appear to make use of `packDataNsec` so I am giving it
the same treatment by moving the logic in a helper function and making
all those types `len` call use that function.
2019-05-21 07:27:24 +01:00
Miek Gieben 087e486609
Run gofmt -w -s (#971)
mechanical run of gofmt.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-20 07:44:53 +01:00
chantra 37f455fa04 [nsec] compute NSEC.len() the same way that we would do in packDataNsec (#967)
The byte sequence, when Unpack()-ed and subsequential Pack()-ed created a
panic: runtime error: slice bounds out of range
github.com/miekg/dns.(*Msg).packBufferWithCompressionMap(0xc0000d4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100, 0x14, 0x14e80b, 0xbf2d4654d501a3c8, ...)
/Users/chantra/go/src/github.com/miekg/dns/msg.go:868 +0x13a8

Confirmed that Unpacking/Repacking payload described in TestCrashNSEC
did not raise a slice bound out of range panic, added unittests which
failed prior to this change.

```
go test -run TestCrashNSEC
--- FAIL: TestCrashNSEC (0.00s)
    types_test.go:135: expected length of 19, got 12
FAIL
exit status 1
FAIL	github.com/miekg/dns	0.067s
```
2019-05-19 08:40:22 +01:00
chantra 2f1ea90356 packDataOpt: fix overflow in packing opt (#966)
An option needs a minimum of 4 bytes that contains OPTION-CODE and OPTION-LENGTH
The code was checkign off + 3 > len(msg) instead of off + 4
2019-05-18 18:23:50 +01:00
Miek Gieben be5ae6ca7a
Add fuzzing framework (#580)
Add easy way to fuzz this dns library, put fuzz related code in fuzz.go
and have a small Makefile.fuzz to be used:

$ make -f Makefile.fuzz build
$ make -f Makefile.fuzz fuzz

Will build and fuzz the library. Both pack/unpack and NewRR are fuzz
targets, but we could open this up.
2017-11-23 09:34:31 +00:00
Miek Gieben b1fe149a97 Check for l.err in $INCLUDE
This can throw l.err as well, and a l.length of zero, check for both.
2015-08-08 13:41:46 +01:00
Miek Gieben 3b3e522e22 A some length check to $GENERATE modifiers
Short cut these modifier lengths to 255 max. Which seems a reasonable default.
2015-08-08 13:31:38 +01:00
Miek Gieben d7ca9f827c And check err here as well. 2015-08-07 16:56:49 +01:00
Miek Gieben 3861fcbbb2 Fix HIP parsing 2015-08-07 16:26:37 +01:00
Miek Gieben d5324dc6e3 Fuzz the text parser
Check if the values send on the channel are errors, if so return
one. Otherwise continue parsing.
2015-08-07 15:01:11 +02:00
Miek Gieben 69d043f8ab Better fuzzing test and NSAP fix
rr can be nil when parsed, if it, for instance only contains a
comment.

NSAP parsing need some parens to make the if-then logic work.
2015-08-07 12:17:16 +02:00
Miek Gieben 1e6d260018 Fuzz NewRR
Add checks for token length == 0.
2015-08-07 10:39:21 +01:00