1
0
mirror of https://github.com/yarrick/iodine.git synced 2024-11-23 05:26:07 +03:00

borken length in allocation, now fixed

This commit is contained in:
Bjorn Andersson 2007-01-28 01:39:19 +00:00
parent 0c8e398941
commit 90e47bbf8b

View File

@ -51,7 +51,7 @@ base32_encode(char **buf, size_t *buflen, const void *data, size_t size)
char *q; char *q;
int i; int i;
newsize = size * 8 / 5 + 5; newsize = 8 * (size / 5 + 1) + 1;
if (newsize > *buflen) { if (newsize > *buflen) {
if ((newbuf = realloc(*buf, newsize)) == NULL) { if ((newbuf = realloc(*buf, newsize)) == NULL) {
free(*buf); free(*buf);
@ -155,7 +155,7 @@ base32_decode(void **buf, size_t *buflen, const char *str)
char *newbuf; char *newbuf;
int len; int len;
newsize = 5 * (strlen(str) / 8 + 4); newsize = 5 * (strlen(str) / 8 + 1) + 1;
if (newsize > *buflen) { if (newsize > *buflen) {
if ((newbuf = realloc(*buf, newsize)) == NULL) { if ((newbuf = realloc(*buf, newsize)) == NULL) {
free(*buf); free(*buf);