[Lldb-commits] [lldb] r263637 - Fix null pointer "dereference" in DomainSocket
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 16 07:03:20 PDT 2016
Author: labath
Date: Wed Mar 16 09:03:20 2016
New Revision: 263637
URL: http://llvm.org/viewvc/llvm-project?rev=263637&view=rev
Log:
Fix null pointer "dereference" in DomainSocket
offsetof is the official way to get the offset of a field in a structure.
Modified:
lldb/trunk/source/Host/posix/DomainSocket.cpp
Modified: lldb/trunk/source/Host/posix/DomainSocket.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/DomainSocket.cpp?rev=263637&r1=263636&r2=263637&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/DomainSocket.cpp (original)
+++ lldb/trunk/source/Host/posix/DomainSocket.cpp Wed Mar 16 09:03:20 2016
@@ -21,7 +21,7 @@ using namespace lldb_private;
#ifdef __ANDROID__
// Android does not have SUN_LEN
#ifndef SUN_LEN
-#define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) + strlen((ptr)->sun_path))
+#define SUN_LEN(ptr) (offsetof(struct sockaddr_un, sun_path) + strlen((ptr)->sun_path))
#endif
#endif // #ifdef __ANDROID__
More information about the lldb-commits
mailing list