mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
Merge pull request #13243 from ibondarenko1:hardening/lisafs-walk-payload-bound
PiperOrigin-RevId: 936966024
This commit is contained in:
@@ -16,7 +16,6 @@ package lisafs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -304,7 +303,7 @@ func WalkHandler(c *Connection, comm Communicator, payloadLen uint32) (uint32, e
|
||||
)
|
||||
respMetaSize := status.SizeBytes() + numInodes.SizeBytes()
|
||||
maxPayloadSize := respMetaSize + (len(req.Path) * (*Inode)(nil).SizeBytes())
|
||||
if maxPayloadSize > math.MaxUint32 {
|
||||
if maxPayloadSize > int(c.maxMessageSize) {
|
||||
// Too much to walk, can't do.
|
||||
return 0, unix.EIO
|
||||
}
|
||||
@@ -406,7 +405,7 @@ func WalkStatHandler(c *Connection, comm Communicator, payloadLen uint32) (uint3
|
||||
// the same as WalkStatResp's.
|
||||
var numStats primitive.Uint16
|
||||
maxPayloadSize := numStats.SizeBytes() + (len(req.Path) * SizeOfStatx)
|
||||
if maxPayloadSize > math.MaxUint32 {
|
||||
if maxPayloadSize > int(c.maxMessageSize) {
|
||||
// Too much to walk, can't do.
|
||||
return 0, unix.EIO
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user