Merge pull request #13243 from ibondarenko1:hardening/lisafs-walk-payload-bound

PiperOrigin-RevId: 936966024
This commit is contained in:
gVisor bot
2026-06-23 16:44:58 -07:00
+2 -3
View File
@@ -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
}