File B0005-base64-Prevent-buffer-overflow-by-not-decoding-blocks-with-less-than-4-chrs.patch of Package libplist.4090
From 62bac060ed5ee6d64a71edf6cc627cc184ae87e5 Mon Sep 17 00:00:00 2001
From: Filippo Bigarella <filippobigarella@gmail.com>
Date: Mon, 31 Oct 2016 02:43:15 +0100
Subject: [PATCH] base64: Prevent buffer overflow by not decoding blocks with
less than 4 chars
---
src/base64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/base64.c b/src/base64.c
index e59d963..1595bd0 100644
--- a/src/base64.c
+++ b/src/base64.c
@@ -118,7 +118,7 @@ unsigned char *base64decode(const char *buf, size_t *size)
break;
}
len = strcspn(ptr, "\r\n\t ");
- if (len > 0) {
+ if (len > 3) {
p+=base64decode_block(outbuf+p, ptr, len);
ptr += len;
} else {