Browse Source

fix(core): Avoid buffer overflow in base64 decoding

Stefan Profanter 5 years ago
parent
commit
c4e5ccdfb4
1 changed files with 2 additions and 1 deletions
  1. 2 1
      deps/base64.c

+ 2 - 1
deps/base64.c

@@ -67,7 +67,8 @@ static const uint32_t from_b64[256] = {
 
 unsigned char *
 UA_unbase64(const unsigned char *src, size_t len, size_t *out_len) {
-    if(len == 0) {
+    // we need a minimum length
+    if(len <= 2) {
         *out_len = 0;
         return (unsigned char*)UA_EMPTY_ARRAY_SENTINEL;
     }