|
@@ -65,6 +65,8 @@
|
|
|
#include <stdio.h>
|
|
|
#include <stdlib.h>
|
|
|
#include <string.h>
|
|
|
+
|
|
|
+#include "assert.h"
|
|
|
#include "utils.h"
|
|
|
|
|
|
static const char Base64[] =
|
|
@@ -144,6 +146,8 @@ int b64_encode(const void *_src, size_t srclength,
|
|
|
u_char output[4];
|
|
|
size_t i;
|
|
|
|
|
|
+ assert(dest && targsize > 0);
|
|
|
+
|
|
|
while (2 < srclength) {
|
|
|
input[0] = *src++;
|
|
|
input[1] = *src++;
|
|
@@ -208,6 +212,8 @@ int b64_decode(const void *_src, void *dest, size_t targsize)
|
|
|
state = 0;
|
|
|
tarindex = 0;
|
|
|
|
|
|
+ assert(dest && targsize > 0);
|
|
|
+
|
|
|
while ((ch = (unsigned char)*src++) != '\0') {
|
|
|
if (isspace(ch)) /* Skip whitespace anywhere. */
|
|
|
continue;
|