[Lldb-commits] [lldb] r203358 - POSIX: fix possible invalid API usage
Saleem Abdulrasool
compnerd at compnerd.org
Sat Mar 8 12:47:07 PST 2014
Author: compnerd
Date: Sat Mar 8 14:47:07 2014
New Revision: 203358
URL: http://llvm.org/viewvc/llvm-project?rev=203358&view=rev
Log:
POSIX: fix possible invalid API usage
strcmp cannot be passed a NULL. Add a short-circuiting check to avoid the
possible API misuse.
Modified:
lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
Modified: lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp?rev=203358&r1=203357&r2=203358&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp Sat Mar 8 14:47:07 2014
@@ -192,7 +192,7 @@ ProcessPOSIX::GetFilePath(
// (/dev/pts). If so, convert to using a different default path
// instead to redirect I/O to the debugger console. This should
// also handle user overrides to /dev/null or a different file.
- if (::strncmp(path, pts_name, ::strlen(pts_name)) == 0)
+ if (!path || ::strncmp(path, pts_name, ::strlen(pts_name)) == 0)
path = default_path;
}
}
More information about the lldb-commits
mailing list