mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
base64:To improve compatibility, there may not be enough equal signs (#1561)
This commit is contained in:
@@ -961,10 +961,12 @@ lb64decode(lua_State *L) {
|
|||||||
int padding = 0;
|
int padding = 0;
|
||||||
int c[4];
|
int c[4];
|
||||||
for (j=0;j<4;) {
|
for (j=0;j<4;) {
|
||||||
if (i>=sz) {
|
if (i>=sz && 4>j){
|
||||||
return luaL_error(L, "Invalid base64 text");
|
/*To improve compatibility, there may not be enough equal signs */
|
||||||
|
c[j] = -2;
|
||||||
|
}else{
|
||||||
|
c[j] = b64index(text[i]);
|
||||||
}
|
}
|
||||||
c[j] = b64index(text[i]);
|
|
||||||
if (c[j] == -1) {
|
if (c[j] == -1) {
|
||||||
++i;
|
++i;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user