aboutsummaryrefslogtreecommitdiff
path: root/nDPId.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-01-09 01:30:40 +0100
committerToni Uhlig <matzeton@googlemail.com>2023-01-09 01:43:24 +0100
commit655393e953086ec24ee18e07b022c6863c5dda5d (patch)
treeb1d4154cc4beb557262bad67a14482afe4963160 /nDPId.c
parente9443d7618276873f2dbcb2bdffca5d9991c1f84 (diff)
nDPid: Fixed base64encode bug which lead to invalid base64 strings.
* py-semantic-validation: Decode base64 raw packet data as well * nDPIsrvd.py: Added PACKETS_PLEN_MAX * nDPIsrvd.py: Improved JSON parse error/exception handling Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'nDPId.c')
-rw-r--r--nDPId.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/nDPId.c b/nDPId.c
index bfa21f464..1b29bc4af 100644
--- a/nDPId.c
+++ b/nDPId.c
@@ -2406,7 +2406,7 @@ static void base64encode(uint8_t const * const data_buf,
* if we have one byte available, then its encoding is spread
* out over two characters
*/
- if (resultIndex + 2 >= *resultSize - padCount - 1)
+ if (resultIndex + 2 >= *resultSize - (3 - padCount))
{
break;
}
@@ -2419,7 +2419,7 @@ static void base64encode(uint8_t const * const data_buf,
*/
if ((x + 1) < dataLength)
{
- if (resultIndex + 1 >= *resultSize - padCount - 1)
+ if (resultIndex + 1 >= *resultSize - (3 - padCount))
{
break;
}
@@ -2432,7 +2432,7 @@ static void base64encode(uint8_t const * const data_buf,
*/
if ((x + 2) < dataLength)
{
- if (resultIndex + 1 >= *resultSize - padCount - 1)
+ if (resultIndex + 1 >= *resultSize - (3 - padCount))
{
break;
}