mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-23 00:29:20 +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;
|
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);
|
||||||
|
|
Loading…
Reference in New Issue