Fix padding extends out of bound

This commit is contained in:
yuhan6665 2023-03-01 08:43:00 -05:00
parent 43bc929030
commit 7b54255cc1

View File

@ -556,6 +556,9 @@ func XtlsPadding(b *buf.Buffer, command byte, userUUID *[]byte, longPadding bool
b.Release()
b = nil
}
if paddingLen > buf.Size - newbuffer.Len() {
paddingLen = buf.Size - newbuffer.Len()
}
newbuffer.Extend(paddingLen)
newError("XtlsPadding ", contantLen, " ", paddingLen, " ", command).WriteToLog(session.ExportIDToError(ctx))
return newbuffer