summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libexslt/crypto.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libexslt/crypto.c b/libexslt/crypto.c
index e2700d6b..42ac6c5b 100644
--- a/libexslt/crypto.c
+++ b/libexslt/crypto.c
@@ -752,7 +752,7 @@ exsltCryptoRc4DecryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
ret_len = exsltCryptoHex2Bin (str, str_len, bin, bin_len);
/* decrypt the binary blob */
- ret = xmlMallocAtomic (ret_len);
+ ret = xmlMallocAtomic (ret_len + 1);
if (ret == NULL) {
xsltTransformError(tctxt, NULL, tctxt->inst,
"exsltCryptoRc4EncryptFunction: Failed to allocate result\n");
@@ -761,6 +761,7 @@ exsltCryptoRc4DecryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
goto done;
}
PLATFORM_RC4_DECRYPT (ctxt, padkey, bin, ret_len, ret, ret_len);
+ ret[ret_len] = 0;
xmlXPathReturnString (ctxt, ret);