]> git.ipfire.org Git - thirdparty/suricata.git/commit
util/base64: add base64 decode fns per RFC
authorShivani Bhardwaj <shivani@oisf.net>
Fri, 19 Apr 2024 11:45:46 +0000 (17:15 +0530)
committerVictor Julien <victor@inliniac.net>
Thu, 25 Apr 2024 04:52:26 +0000 (06:52 +0200)
commit885d540dea9192589e784b918698d12477ee2695
treeb1a872dc0b6ecac6c8818ad926bab8fc7f50fb50
parent4f1e71bb4e7cf65a4fbe6a792c85ceb6498d96de
util/base64: add base64 decode fns per RFC

Base64 decoder tried to handle several different cases in one fn
including how the data should be decoded and corresponding consumed and
decoded bytes calculated for RFC 2045 and RFC 4648 which are very
different. This left window for mistakes and edge cases that one mode is
not supposed to take care of while the other can.

Separate the decoder per RFC so as to have each variable their own scope
and playground. This also makes it much easier to debug if there are any
issues in decoding w.r.t. different callers.

This also takes care of some known issues like making sure the consumed
bytes are correctly handled.

Bug 6964
src/util-base64.c