提交 aed693b9 authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-5436 --resolve

上级 b73e2c51
...@@ -666,6 +666,9 @@ SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size ...@@ -666,6 +666,9 @@ SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size
while (l >= 6) { while (l >= 6) {
out[bytes++] = switch_b64_table[(b >> (l -= 6)) % 64]; out[bytes++] = switch_b64_table[(b >> (l -= 6)) % 64];
if (bytes >= olen - 1) {
goto end;
}
if (++y != 72) { if (++y != 72) {
continue; continue;
} }
...@@ -678,11 +681,15 @@ SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size ...@@ -678,11 +681,15 @@ SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size
out[bytes++] = switch_b64_table[((b % 16) << (6 - l)) % 64]; out[bytes++] = switch_b64_table[((b % 16) << (6 - l)) % 64];
} }
if (l != 0) { if (l != 0) {
while (l < 6) { while (l < 6 && bytes < olen - 1) {
out[bytes++] = '=', l += 2; out[bytes++] = '=', l += 2;
} }
} }
end:
out[bytes] = '\0';
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论