mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(rpc2): prevent unmarshal initialized proto struct cause EOF
with #22985316 Signed-off-by: xiejian <xiejian3@oppo.com>
This commit is contained in:
parent
19f006b1f4
commit
83b87cb839
@ -86,6 +86,9 @@ func (req *Request) ParseParameter(para Unmarshaler) error {
|
||||
if len(req.Parameter) > 0 {
|
||||
return para.Unmarshal(req.Parameter[:])
|
||||
}
|
||||
if req.ContentLength == 0 {
|
||||
return para.Unmarshal(nil)
|
||||
}
|
||||
_, err := req.Body.WriteTo(LimitWriter(Codec2Writer(para, int(req.ContentLength)), req.ContentLength))
|
||||
if err != nil {
|
||||
return NewError(400, "ParseParameter", err.Error())
|
||||
|
||||
@ -783,10 +783,7 @@ func (s *shard) validateUnitUpdate(node clustermgr.ShardUnit) bool {
|
||||
}
|
||||
}
|
||||
// prevent update shard unit not exist
|
||||
if !exist {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return exist
|
||||
}
|
||||
|
||||
func (s *shard) checkShardOptHeader(h OpHeader) error {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user