armor: reject empty lines in armored data

Caught by the new CCTV test vectors!
This commit is contained in:
Filippo Valsorda
2025-12-07 21:15:38 +01:00
committed by Filippo Valsorda
parent d7409cdc74
commit 96b6476140
4 changed files with 27 additions and 3 deletions

View File

@@ -140,6 +140,9 @@ func (r *armoredReader) Read(p []byte) (int, error) {
if string(line) == Footer {
return 0, r.setErr(drainTrailing())
}
if len(line) == 0 {
return 0, r.setErr(errors.New("empty line in armored data"))
}
if len(line) > format.ColumnsPerLine {
return 0, r.setErr(errors.New("column limit exceeded"))
}