prevent out-of-memory errors (#5674)
impose a maximum size on body of incoming HTTP requests and responses.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package api //nolint:revive
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/conf"
|
||||
@@ -18,7 +19,7 @@ func (a *API) onConfigPathDefaultsGet(ctx *gin.Context) {
|
||||
|
||||
func (a *API) onConfigPathDefaultsPatch(ctx *gin.Context) {
|
||||
var p conf.OptionalPath
|
||||
err := jsonwrapper.Decode(ctx.Request.Body, &p)
|
||||
err := jsonwrapper.Decode(io.LimitReader(ctx.Request.Body, maxInboundConfigSize), &p)
|
||||
if err != nil {
|
||||
a.writeError(ctx, http.StatusBadRequest, err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user