Mercurial > prosody-modules
changeset 153:31e24026e4fd
mod_tcpproxy: Handle gracefully invalid base64 data, fixes #2 (thanks dersd)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 19 May 2010 14:02:19 +0100 |
parents | 4ca382e8a4c5 |
children | 1849614af19a |
files | mod_tcpproxy/mod_tcpproxy.lua |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_tcpproxy/mod_tcpproxy.lua Sat May 15 23:05:53 2010 +0500 +++ b/mod_tcpproxy/mod_tcpproxy.lua Wed May 19 14:02:19 2010 +0100 @@ -84,7 +84,14 @@ elseif ibb_tag.name == "data" then local conn = open_connections[stanza.attr.from][ibb_tag.attr.sid]; if conn then - conn:write(unb64(ibb_tag:get_text())); + local data = unb64(ibb_tag:get_text()); + if data then + conn:write(data); + else + return origin.send( + st.error_reply(stanza, "modify", "bad-request", "Invalid data (base64?)") + ); + end else return origin.send(st.error_reply(stanza, "cancel", "item-not-found")); end