mirror of
https://github.com/emmansun/gmsm.git
synced 2025-06-28 00:13:26 +08:00
padding: fix codeql reported security issue
This commit is contained in:
parent
59f85b654e
commit
8cfcf01ec3
@ -28,13 +28,13 @@ func (pad iso9797M3Padding) Pad(src []byte) []byte {
|
|||||||
overhead = 0
|
overhead = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var head, tail []byte
|
if srcLen > (int(^uint(0) >> 1) - overhead - pad.BlockSize()) {
|
||||||
total := srcLen + overhead + pad.BlockSize()
|
|
||||||
|
|
||||||
if total <= 0 {
|
|
||||||
panic("padding: total length overflow")
|
panic("padding: total length overflow")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var head, tail []byte
|
||||||
|
total := srcLen + overhead + pad.BlockSize()
|
||||||
|
|
||||||
if cap(src) >= total {
|
if cap(src) >= total {
|
||||||
head = src[:total]
|
head = src[:total]
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user