From d41fca11af4f821b58cb840ce85127c0cb1ff962 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sat, 8 Mar 2014 20:47:07 +0000 Subject: [PATCH] POSIX: fix possible invalid API usage strcmp cannot be passed a NULL. Add a short-circuiting check to avoid the possible API misuse. llvm-svn: 203358 --- lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp index acc4418..f4b1dd7 100644 --- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp +++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp @@ -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; } } -- 2.7.4