rk_base64_encode(): set errno in all error cases
authorNicolas Williams <nico@twosigma.com>
Mon, 12 Aug 2019 22:55:40 +0000 (17:55 -0500)
committerNicolas Williams <nico@twosigma.com>
Thu, 3 Oct 2019 18:09:18 +0000 (13:09 -0500)
lib/roken/base64.c

index 6ee4899e53312f281d2c91e1b861d3fd9f49630f..93eac061eefe524e6a4161456239b1ac864b4a56 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <config.h>
 
+#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
@@ -61,6 +62,7 @@ rk_base64_encode(const void *data, int size, char **str)
 
     if (size > INT_MAX/4 || size < 0) {
        *str = NULL;
+        errno = ERANGE;
        return -1;
     }