accept input of exactly the documented size limit
ci / build (push) Successful in 28s

Review found the cap used as an output bound as well as an input bound: a file
of exactly 1 GiB, the documented maximum, was rejected twice. scr_read_fd could
not tell a full buffer from a larger input, and scr_encrypt refused anything
over SCR_INPUT_MAX minus the envelope overhead. The reader now probes a single
byte past a full buffer to distinguish the two, and the encrypt guard is a
plain size_t overflow check.

The suite builds a second binary with -DSCR_INPUT_MAX=65536 so both sides of the
boundary are tested without a 1 GiB file; the previous code fails the exact-cap
case. Also adds CRLF armor and 'a failed decrypt leaves the output file alone'
cases, and documents that -r on a protected key asks for its passphrase.
This commit is contained in:
lotherk committed 2026-11-21 20:07:04 +00:00
1 parent 2c381cbe75
commit 154d25be91
7 files changed
+67 -3

No files matched your search

+1
View File
@@ -63,6 +63,7 @@ The recipient's public key, in
.I authorized_keys
format.
A private key is accepted too: its public half is derived from it.
If that key has a passphrase, it is asked for first.
A file that holds more than one supported key is rejected.
.TP
.BR \-k ", " \-\-key " " \fIFILE\fP