Skip to content
Snippets Groups Projects
Commit 7dbb01b3 authored by deuce's avatar deuce
Browse files

Fix error in last commit.

parent 1950c9bf
No related branches found
No related tags found
No related merge requests found
...@@ -131,14 +131,16 @@ int b64_encode(char *target, size_t tlen, const char *source, size_t slen) { ...@@ -131,14 +131,16 @@ int b64_encode(char *target, size_t tlen, const char *source, size_t slen) {
FREE_AND_NULL(tmpbuf); FREE_AND_NULL(tmpbuf);
return(-1); return(-1);
} }
if(inp==inend) if (inp>=inend)
done=1; enc=buf;
if (!done) else
enc=buf|((*inp & 0xF0) >> 4); enc=buf|((*inp & 0xF0) >> 4);
if(add_char(outp++, enc, done, outend)) { if(add_char(outp++, enc, done, outend)) {
FREE_AND_NULL(tmpbuf); FREE_AND_NULL(tmpbuf);
return(-1); return(-1);
} }
if(inp==inend)
done=1;
if (!done) { if (!done) {
buf=(*(inp++)<<2)&0x3C; buf=(*(inp++)<<2)&0x3C;
if (inp == inend) if (inp == inend)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment