feat: enhance firefox 144+ master key retrieval and improve padding validation (#499)

* feat: enhance firefox 144+ master key retrieval and improve padding validation

* fix: correct SQL query casing in nssPrivate test

* fix: reorder import statements in firefox.go for consistency
This commit is contained in:
Aquilao Official
2026-03-03 11:56:44 +08:00
committed by GitHub
parent 1ae127efb1
commit 3a89cb63ce
3 changed files with 131 additions and 8 deletions
+8
View File
@@ -143,6 +143,14 @@ func pkcs5UnPadding(src []byte) ([]byte, error) {
if padding < 1 || padding > aes.BlockSize {
return nil, errors.New("pkcs5UnPadding: invalid padding size")
}
if padding > length {
return nil, errors.New("pkcs5UnPadding: invalid padding length")
}
for _, b := range src[length-padding:] {
if int(b) != padding {
return nil, errors.New("pkcs5UnPadding: invalid padding content")
}
}
return src[:length-padding], nil
}