0021-soup-multipart-Verify-array-bounds.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From a7d0c58608ed830bedfb6b92aea11e00feb55aa9 Mon Sep 17 00:00:00 2001
  2. From: Milan Crha <mcrha@redhat.com>
  3. Date: Mon, 19 May 2025 17:48:27 +0200
  4. Subject: [PATCH] soup-multipart: Verify array bounds before accessing its
  5. members
  6. The boundary could be at a place which, calculated, pointed
  7. before the beginning of the array. Check the bounds, to avoid
  8. read out of the array bounds.
  9. Closes https://gitlab.gnome.org/GNOME/libsoup/-/issues/447
  10. CVE: CVE-2025-4969
  11. Upstream-Status: Backport
  12. [https://gitlab.gnome.org/GNOME/libsoup/-/merge_requests/467/diffs?commit_id=b5b4dd10d4810f0c87b4eaffe88504f06e502f33]
  13. Upstream: https://git.openembedded.org/meta-openembedded/tree/meta-oe/recipes-support/libsoup/libsoup-2.4/CVE-2025-4969.patch
  14. Signed-off-by: Changqing Li <changqing.li@windriver.com>
  15. Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
  16. ---
  17. libsoup/soup-multipart.c | 2 +-
  18. 1 file changed, 1 insertion(+), 1 deletion(-)
  19. diff --git a/libsoup/soup-multipart.c b/libsoup/soup-multipart.c
  20. index ce2fc10..a29cdf0 100644
  21. --- a/libsoup/soup-multipart.c
  22. +++ b/libsoup/soup-multipart.c
  23. @@ -108,7 +108,7 @@ find_boundary (const char *start, const char *end,
  24. continue;
  25. /* Check that it's at start of line */
  26. - if (!(b == start || (b[-1] == '\n' && b[-2] == '\r')))
  27. + if (!(b == start || (b - start >= 2 && b[-1] == '\n' && b[-2] == '\r')))
  28. continue;
  29. /* Check for "--" or "\r\n" after boundary */
  30. --
  31. 2.34.1