]> git.ipfire.org Git - thirdparty/openssl.git/commit
apps/enc.c: avoid signed integer overflow on bufsize assignment
authorEugene Syromiatnikov <esyr@openssl.org>
Mon, 1 Sep 2025 12:05:33 +0000 (14:05 +0200)
committerNeil Horman <nhorman@openssl.org>
Mon, 8 Sep 2025 21:09:20 +0000 (17:09 -0400)
commitae23415ade445d8e0c96e4c98c44f4baaffb98cb
tree70b62528f4d79816545e51251f4c6386dc88b632
parent70baefc22c107dc2857004cd8552d90657b765f5
apps/enc.c: avoid signed integer overflow on bufsize assignment

The calculated option value, while being long-typed, is not checked
for fitting into int-sized bufsize.  Avoid overflow by throwing error
if it is bigger than INT_MAX and document that behaviour.

Fixes: 7e1b7485706c "Big apps cleanup (option-parsing, etc)"
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665149
References: https://github.com/openssl/project/issues/1362
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28407)

(cherry picked from commit e8cfa4ef4a91311fd1188b3eee8bfc9c8d9e7695)
apps/enc.c
doc/man1/openssl-enc.pod.in