]> www.infradead.org Git - users/dwmw2/openconnect.git/commit
Correct calculation of base64 encode buffer length.
authorTom Carroll <incentivedesign@gmail.com>
Tue, 18 May 2021 06:58:23 +0000 (23:58 -0700)
committerTom Carroll <incentivedesign@gmail.com>
Tue, 18 May 2021 06:58:23 +0000 (23:58 -0700)
commit5b42aa777136a10ee7895c94f0e10d9c1f1609d0
tree5d445702e82c87b611f8a699b6469e5b9b53f2aa
parent98f90f2f596502520f1bd3e959c9978d81c04777
Correct calculation of base64 encode buffer length.

In the previous formulation, it would first multiple then divide. It would then
promote to unsigned int. The formula would overflow for large len. For example,
needed = 2 when len == INT_MAX. In the revised formulation, it is promoted,
divided, then multiplied. The revised calculation avoids the overflow and
computes needed correctly over len in {0, 1, ..., INT_MAX}.  For len == INT_MAX,
needed is correctly computed as 2863311533.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
http-auth.c