aboutsummaryrefslogtreecommitdiff
path: root/src/lib/encoding
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-12-20 08:36:25 -0500
committerNick Mathewson <nickm@torproject.org>2018-12-20 08:36:25 -0500
commita517daa56f5848d25ba79617a1a7b82ed2b0a7c0 (patch)
tree88bddb2445449578fefd399ed73a46435113bf2c /src/lib/encoding
parent973a5db80851838e4516de40afe028bc10c425f0 (diff)
downloadtor-a517daa56f5848d25ba79617a1a7b82ed2b0a7c0.tar.gz
tor-a517daa56f5848d25ba79617a1a7b82ed2b0a7c0.zip
base32_decode(): Return number of bytes written on success.
This makes it consistent with base64_decode(). Closes ticket 28913.
Diffstat (limited to 'src/lib/encoding')
-rw-r--r--src/lib/encoding/binascii.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/encoding/binascii.c b/src/lib/encoding/binascii.c
index 067db075ad..a7662658f0 100644
--- a/src/lib/encoding/binascii.c
+++ b/src/lib/encoding/binascii.c
@@ -84,7 +84,7 @@ base32_encode(char *dest, size_t destlen, const char *src, size_t srclen)
}
/** Implements base32 decoding as in RFC 4648.
- * Returns 0 if successful, -1 otherwise.
+ * Return the number of bytes decoded if successful; -1 otherwise.
*/
int
base32_decode(char *dest, size_t destlen, const char *src, size_t srclen)
@@ -147,7 +147,7 @@ base32_decode(char *dest, size_t destlen, const char *src, size_t srclen)
memset(tmp, 0, srclen); /* on the heap, this should be safe */
tor_free(tmp);
tmp = NULL;
- return 0;
+ return i;
}
#define BASE64_OPENSSL_LINELEN 64