A some length check to $GENERATE modifiers
Short cut these modifier lengths to 255 max. Which seems a reasonable default.
This commit is contained in:
parent
58c5f4cf6e
commit
3b3e522e22
|
@ -8,6 +8,7 @@ func TestFuzzString(t *testing.T) {
|
|||
" NSAP O ", " NSAP N ",
|
||||
" TYPE4 TYPE6a789a3bc0045c8a5fb42c7d1bd998f5444 IN 9579b47d46817afbd17273e6",
|
||||
" TYPE45 3 3 4147994 TYPE\\(\\)\\)\\(\\)\\(\\(\\)\\(\\)\\)\\)\\(\\)\\(\\)\\(\\(\\R 948\"\")\\(\\)\\)\\)\\(\\ ",
|
||||
"$GENERATE 0-3 ${441189,5039418474430,o}",
|
||||
}
|
||||
for i, tc := range testcases {
|
||||
rr, err := NewRR(tc)
|
||||
|
|
|
@ -141,11 +141,11 @@ func modToPrintf(s string) (string, int, string) {
|
|||
return "", 0, "bad base in $GENERATE"
|
||||
}
|
||||
offset, err := strconv.Atoi(xs[0])
|
||||
if err != nil {
|
||||
if err != nil || offset > 255 {
|
||||
return "", 0, "bad offset in $GENERATE"
|
||||
}
|
||||
width, err := strconv.Atoi(xs[1])
|
||||
if err != nil {
|
||||
if err != nil || width > 255 {
|
||||
return "", offset, "bad width in $GENERATE"
|
||||
}
|
||||
switch {
|
||||
|
|
Loading…
Reference in New Issue