Advisory

GHSA-hwqm-qvj9-4jr2

Details, part 2 of 2. The advisory

Details

Key changes:

  1. Remove `bytes.TrimRight(data, "\x00")` entirely — it corrupts valid PKCS#7-padded data and creates the empty-slice condition.
  2. Bounds-check `padLength` before using it as a slice index.
  3. Validate all padding bytes match (proper PKCS#7 verification).
  4. Return errors instead of panicking on malformed input.

Sources & licences