Skip to content

Commit 0f0f820

Browse files
committed
ensure valid range param
1 parent 2831f6c commit 0f0f820

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/code/handler.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ func parseRange(r string) (int64, int64, error) {
3333
return 0, 0, err
3434
}
3535

36+
if sz := endPos + 1 - beginPos; sz <= 0 || sz > 50*1024*1024 {
37+
return 0, 0, fmt.Errorf("invalid range: %s", r)
38+
}
39+
3640
return beginPos, endPos + 1, nil
3741
}
3842

0 commit comments

Comments
 (0)