Eric Pouech : dbghelp: Fix allocation error in image_load_debugaltlink.

Alexandre Julliard julliard at winehq.org
Mon Nov 22 16:05:18 CST 2021


Module: wine
Branch: master
Commit: 789512beee9e8e88b2e185ca5ff89fe49ba8703a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=789512beee9e8e88b2e185ca5ff89fe49ba8703a

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Mon Nov 22 15:20:54 2021 +0100

dbghelp: Fix allocation error in image_load_debugaltlink.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dbghelp/module.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c
index 363f6314b22..73243d80da5 100644
--- a/dlls/dbghelp/module.c
+++ b/dlls/dbghelp/module.c
@@ -671,9 +671,9 @@ struct image_file_map* image_load_debugaltlink(struct image_file_map* fmap, stru
          */
         sect_len = image_get_map_size(&debugaltlink_sect);
         id = memchr(data, '\0', sect_len);
-        if (id)
+        if (id++)
         {
-            id++;
+            unsigned idlen = (const BYTE*)data + sect_len - id;
             fmap_link = HeapAlloc(GetProcessHeap(), 0, sizeof(*fmap_link));
             if (fmap_link)
             {
@@ -691,7 +691,8 @@ struct image_file_map* image_load_debugaltlink(struct image_file_map* fmap, stru
                 {
                     static const WCHAR globalDebugDirW[] =
                         {'/','u','s','r','/','l','i','b','/','d','e','b','u','g','/','.','b','u','i','l','d','-','i','d','/'};
-                    dst = HeapAlloc(GetProcessHeap(), 0, sizeof(globalDebugDirW) + (3 + filename_len) * sizeof(WCHAR));
+                    dst = HeapAlloc(GetProcessHeap(), 0,
+                                    sizeof(globalDebugDirW) + (3 + filename_len + idlen * 2) * sizeof(WCHAR));
                     if (dst)
                     {
                         WCHAR* p;




More information about the wine-cvs mailing list