Allocate more space for the base64 output we need to generate.

Closes issue #10913, reported by tootai, who graciously granted us access
to his Asterisk server, thanks! Daniel, feel free to reopen the bug in
case you can reproduce this on 1.4.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@85551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Philippe Sultan 18 years ago
parent c2ba92b385
commit ad83510903

@ -561,10 +561,10 @@ static int aji_start_sasl(iksparser *prs, enum ikssasltype type, char *username,
iks_insert_attrib(x, "xmlns", IKS_NS_XMPP_SASL); iks_insert_attrib(x, "xmlns", IKS_NS_XMPP_SASL);
len = strlen(username) + strlen(pass) + 3; len = strlen(username) + strlen(pass) + 3;
s = alloca(len); s = alloca(len);
base64 = alloca((len + 1) * 4 / 3); base64 = alloca((len + 2) * 4 / 3);
iks_insert_attrib(x, "mechanism", "PLAIN"); iks_insert_attrib(x, "mechanism", "PLAIN");
snprintf(s, len, "%c%s%c%s", 0, username, 0, pass); snprintf(s, len, "%c%s%c%s", 0, username, 0, pass);
ast_base64encode(base64, (const unsigned char *) s, len, (len + 1) * 4 / 3); ast_base64encode(base64, (const unsigned char *) s, len, (len + 2) * 4 / 3);
iks_insert_cdata(x, base64, 0); iks_insert_cdata(x, base64, 0);
iks_send(prs, x); iks_send(prs, x);
iks_delete(x); iks_delete(x);

Loading…
Cancel
Save