mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-26 10:09:19 +02:00
borken length in allocation, now fixed
This commit is contained in:
parent
0c8e398941
commit
90e47bbf8b
|
@ -51,7 +51,7 @@ base32_encode(char **buf, size_t *buflen, const void *data, size_t size)
|
|||
char *q;
|
||||
int i;
|
||||
|
||||
newsize = size * 8 / 5 + 5;
|
||||
newsize = 8 * (size / 5 + 1) + 1;
|
||||
if (newsize > *buflen) {
|
||||
if ((newbuf = realloc(*buf, newsize)) == NULL) {
|
||||
free(*buf);
|
||||
|
@ -155,7 +155,7 @@ base32_decode(void **buf, size_t *buflen, const char *str)
|
|||
char *newbuf;
|
||||
int len;
|
||||
|
||||
newsize = 5 * (strlen(str) / 8 + 4);
|
||||
newsize = 5 * (strlen(str) / 8 + 1) + 1;
|
||||
if (newsize > *buflen) {
|
||||
if ((newbuf = realloc(*buf, newsize)) == NULL) {
|
||||
free(*buf);
|
||||
|
|
Loading…
Reference in New Issue