Insure start and limit query params do not overflow limit
This commit is contained in:
parent
878ddbbf09
commit
d7469c30d5
1 changed files with 6 additions and 0 deletions
|
@ -29,6 +29,9 @@ import (
|
|||
func limit(c *fibre.Context, i int64) int64 {
|
||||
if s := c.Query("limit"); len(s) > 0 {
|
||||
if x, err := strconv.ParseInt(s, 10, 64); err == nil {
|
||||
if x > i {
|
||||
return i
|
||||
}
|
||||
return x
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +41,9 @@ func limit(c *fibre.Context, i int64) int64 {
|
|||
func start(c *fibre.Context, i int64) int64 {
|
||||
if s := c.Query("start"); len(s) > 0 {
|
||||
if x, err := strconv.ParseInt(s, 10, 64); err == nil {
|
||||
if x < i {
|
||||
return i
|
||||
}
|
||||
return x
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue