diff --git a/src/utils/base64.c b/src/utils/base64.c index 0eadb8142..13fc511dc 100644 --- a/src/utils/base64.c +++ b/src/utils/base64.c @@ -43,6 +43,8 @@ unsigned char * base64_encode(const unsigned char *src, size_t len, olen = len * 4 / 3 + 4; /* 3-byte blocks to 4-byte */ olen += olen / 72; /* line feeds */ olen++; /* nul termination */ + if (olen < len) + return NULL; /* integer overflow */ out = os_malloc(olen); if (out == NULL) return NULL;