From 9c348a4bc8701f88760ac9d5db5d2898ed7ac159 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 19 Apr 2020 05:13:51 +0000 Subject: [PATCH] Fix underflow bug in Base64_EncodeBlock git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5673 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engine/common/common.c b/engine/common/common.c index 22f1f3dfa..099d3a019 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -6066,6 +6066,8 @@ size_t Base64_EncodeBlock(const qbyte *in, size_t length, char *out, size_t outs if (out < end) *out++ = (length>=3)?Base64_Encode((v>>0)&63):'='; in+=3; + if (length <= 3) + break; length -= 3; } end++;