The vulnerability arises because the checksum length (s2length) is derived from an unvalidated protocol input (MAX_DIGEST_LEN), which can exceed the size of the pre-allocated buffer (SUM_LENGTH), allowing attackers to exploit this behavior.