Re: [PATCH v3] scsi: target: iscsi: validate CHAP_R length before base64 decode

Alexandru Hossu <[email protected]> Fri, 22 May 2026 03:37:41 -0700 (PDT)
Newsgroups org.kernel.vger.target-devel,org.kernel.vger.linux-scsi,org.kernel.vger.stable
Message-ID <[email protected]>
On Fri, May 22, 2026, Hannes Reinecke wrote:
> The length check should be part of the chap_base64_decode() function,
> which should reject inputs with the wrong length. _And_ you need
> to add a 'length' argument for 'client_digest' such that the function
> knows the size of the output buffer and can avoid precisely these
> issues.

Thank you for the feedback. Adding a dst_len parameter to
chap_base64_decode() and moving the overflow check inside the decoder
is a cleaner approach and I agree it is the right direction.

v4 carries David's Reviewed-by and fixes the immediate overflow with a
minimal diff. Would it be acceptable to merge v4 as a quick fix for the
overflow, with a follow-up patch that adds the dst_len parameter to
chap_base64_decode() and removes the pre-check?

Alexandru