Author: Saleem Abdulrasool
Date: 2022-04-16T18:01:02-07:00
New Revision: 2696d82fa0c323d92d8794f0a34ea9619888fae9

URL: 
https://github.com/llvm/llvm-project/commit/2696d82fa0c323d92d8794f0a34ea9619888fae9
DIFF: 
https://github.com/llvm/llvm-project/commit/2696d82fa0c323d92d8794f0a34ea9619888fae9.diff

LOG: Windows: correct iteration of additional search paths

This adjusts the path iteration - `paths` is a null-terminated sequence
of C strings, creating an array from a single contiguous buffer.  We
would previously continue to iterate indefinitely as we did not check if
we had encountered the terminator.

Found by inspection.

Added: 
    

Modified: 
    lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp 
b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index b0501af7df30b..38f387dfdb29d 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -651,7 +651,7 @@ _Static_assert(sizeof(struct __lldb_LoadLibraryResult) <= 3 
* sizeof(void *),
 
 void * __lldb_LoadLibraryHelper(const wchar_t *name, const wchar_t *paths,
                                 __lldb_LoadLibraryResult *result) {
-  for (const wchar_t *path = paths; path; ) {
+  for (const wchar_t *path = paths; path && *path; ) {
     (void)AddDllDirectory(path);
     path += wcslen(path) + 1;
   }


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to