]> git.ipfire.org Git - thirdparty/suricata.git/commit
datasets/string: fix buffer overflow
authorShivani Bhardwaj <shivanib134@gmail.com>
Thu, 3 Dec 2020 11:13:17 +0000 (16:43 +0530)
committerVictor Julien <victor@inliniac.net>
Thu, 3 Dec 2020 14:17:38 +0000 (15:17 +0100)
commitb0a6ed1e2a2a96419a6c8c80b1bd4067d518c5a0
treea8f1d24df6ec3fae6de4c0e183ba51b33b475d39
parent02942a123a525bb1ed97bba9242f1e08d54f0fb8
datasets/string: fix buffer overflow

The size of encoded_data array and the maximum output length parameter
to Base64Encode function were incorrect leading to buffer overflow for
certain cases. The algorithm requires at least 5 bytes of space to even
convert a string of length 1.

Use BASE64_BUFFER_SIZE macro to correctly calculate this output length.
Set size of encoded_data array to the calculated output length.
src/datasets-string.c