base64: 4 bytes are always necessary

Wed, 25 Mar 2020 16:54:36 +0100

author
David Demelier <markand@malikania.fr>
date
Wed, 25 Mar 2020 16:54:36 +0100
changeset 23
fe5437c0fa3d
parent 22
9205a516264d
child 24
90760aa2e7ed

base64: 4 bytes are always necessary

base64.c file | annotate | diff | comparison | revisions
--- a/base64.c	Wed Mar 25 16:50:43 2020 +0100
+++ b/base64.c	Wed Mar 25 16:54:36 2020 +0100
@@ -93,7 +93,7 @@
 		while (*src && count < 3)
 			inputbuf[count++] = *src++;
 
-		if (count >= dstsz) {
+		if (dstsz < 4) {
 			errno = ERANGE;
 			return -1;
 		}

mercurial