0017-Fix-double-free-in-libexslt-hash-functions.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From d8862309f08054218b28e2c8f5fb3cb2f650cac7 Mon Sep 17 00:00:00 2001
  2. From: Nick Wellnhofer <wellnhofer@aevum.de>
  3. Date: Wed, 20 Apr 2016 14:35:43 +0200
  4. Subject: [PATCH] Fix double free in libexslt hash functions
  5. Thanks to Nicolas Gregoire for the report.
  6. Fixes bug #765271:
  7. https://bugzilla.gnome.org/show_bug.cgi?id=765271
  8. ---
  9. libexslt/crypto.c | 15 +++------------
  10. tests/exslt/crypto/hash.1.out | 2 ++
  11. tests/exslt/crypto/hash.1.xml | 5 +++++
  12. 3 files changed, 10 insertions(+), 12 deletions(-)
  13. --- a/libexslt/crypto.c
  14. +++ b/libexslt/crypto.c
  15. @@ -498,11 +498,8 @@ exsltCryptoMd4Function (xmlXPathParserCo
  16. unsigned char hex[MD5_DIGEST_LENGTH * 2 + 1];
  17. str_len = exsltCryptoPopString (ctxt, nargs, &str);
  18. - if (str_len == 0) {
  19. - xmlXPathReturnEmptyString (ctxt);
  20. - xmlFree (str);
  21. + if (str_len == 0)
  22. return;
  23. - }
  24. PLATFORM_HASH (ctxt, PLATFORM_MD4, (const char *) str, str_len,
  25. (char *) hash);
  26. @@ -531,11 +528,8 @@ exsltCryptoMd5Function (xmlXPathParserCo
  27. unsigned char hex[MD5_DIGEST_LENGTH * 2 + 1];
  28. str_len = exsltCryptoPopString (ctxt, nargs, &str);
  29. - if (str_len == 0) {
  30. - xmlXPathReturnEmptyString (ctxt);
  31. - xmlFree (str);
  32. + if (str_len == 0)
  33. return;
  34. - }
  35. PLATFORM_HASH (ctxt, PLATFORM_MD5, (const char *) str, str_len,
  36. (char *) hash);
  37. @@ -564,11 +558,8 @@ exsltCryptoSha1Function (xmlXPathParserC
  38. unsigned char hex[SHA1_DIGEST_LENGTH * 2 + 1];
  39. str_len = exsltCryptoPopString (ctxt, nargs, &str);
  40. - if (str_len == 0) {
  41. - xmlXPathReturnEmptyString (ctxt);
  42. - xmlFree (str);
  43. + if (str_len == 0)
  44. return;
  45. - }
  46. PLATFORM_HASH (ctxt, PLATFORM_SHA1, (const char *) str, str_len,
  47. (char *) hash);