[MM-38321] Fix possible panics during license validation (#18333)
* Fix possible panics during license validation * Return error if non 2xx code is returned by trial request server
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
21a53320d3
Коммит
236d46ecc6
@@ -71,16 +71,16 @@ func (l *LicenseValidatorImpl) ValidateLicense(signed []byte) (bool, string) {
|
||||
return false, ""
|
||||
}
|
||||
|
||||
// remove null terminator
|
||||
for len(decoded) > 0 && decoded[len(decoded)-1] == byte(0) {
|
||||
decoded = decoded[:len(decoded)-1]
|
||||
}
|
||||
|
||||
if len(decoded) <= 256 {
|
||||
mlog.Error("Signed license not long enough")
|
||||
return false, ""
|
||||
}
|
||||
|
||||
// remove null terminator
|
||||
for decoded[len(decoded)-1] == byte(0) {
|
||||
decoded = decoded[:len(decoded)-1]
|
||||
}
|
||||
|
||||
plaintext := decoded[:len(decoded)-256]
|
||||
signature := decoded[len(decoded)-256:]
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user