Skip to content

Commit fa06778

Browse files
committed
Fix query-size reset and negative value validation
1 parent 57e86bd commit fa06778

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

cmd/scan.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,11 @@ func runScan(cmd *cobra.Command, args []string) error {
9090
querySize, _ := cmd.Flags().GetInt("query-size")
9191
cidrRanges, _ := cmd.Flags().GetStringSlice("cidr")
9292

93-
// Apply query size (dnstt-client MTU)
94-
if querySize > 0 {
95-
scanner.DnsttMTU = querySize
93+
// Apply query size (dnstt-client MTU); 0 = use max
94+
if querySize < 0 {
95+
return fmt.Errorf("--query-size must be >= 0 (got %d)", querySize)
9696
}
97+
scanner.DnsttMTU = querySize
9798

9899
// Apply EDNS buffer size
99100
if ednsSize > 0 && ednsSize <= 65535 {

internal/tui/screen_welcome.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,12 @@ func parseCLIFlags(m *Model, raw string) {
153153
}
154154
case "--query-size":
155155
if next != "" {
156-
fmt.Sscanf(next, "%d", &m.config.QuerySize)
157-
m.configInputs[txtQuerySize].SetValue(next)
156+
var qs int
157+
fmt.Sscanf(next, "%d", &qs)
158+
if qs >= 0 {
159+
m.config.QuerySize = qs
160+
m.configInputs[txtQuerySize].SetValue(next)
161+
}
158162
i++
159163
}
160164
case "--e2e":

0 commit comments

Comments
 (0)