Commit 62bac060 authored by Filippo Bigarella's avatar Filippo Bigarella Committed by Nikias Bassen

base64: Prevent buffer overflow by not decoding blocks with less than 4 chars

parent eec2e855
...@@ -118,7 +118,7 @@ unsigned char *base64decode(const char *buf, size_t *size) ...@@ -118,7 +118,7 @@ unsigned char *base64decode(const char *buf, size_t *size)
break; break;
} }
len = strcspn(ptr, "\r\n\t "); len = strcspn(ptr, "\r\n\t ");
if (len > 0) { if (len > 3) {
p+=base64decode_block(outbuf+p, ptr, len); p+=base64decode_block(outbuf+p, ptr, len);
ptr += len; ptr += len;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment