Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

dtrace: check if _handle property is set

Check that _handle is an object before trying to read its `fd`
property, avoids bogus values.
  • Loading branch information...
commit 9b8dd395536df3dbb21423dba888998f2cd36d2a 1 parent aa5da48
@bnoordhuis bnoordhuis authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/node_dtrace.cc
View
8 src/node_dtrace.cc
@@ -91,8 +91,12 @@ using namespace v8;
} \
node_dtrace_connection_t conn; \
Local<Object> _##conn = Local<Object>::Cast(arg); \
- Local<Object> _handle = (_##conn)->Get(String::New("_handle"))->ToObject(); \
- SLURP_INT(_handle, fd, &conn.fd); \
+ Local<Value> _handle = (_##conn)->Get(String::New("_handle")); \
+ if (_handle->IsObject()) { \
+ SLURP_INT(_handle.As<Object>(), fd, &conn.fd); \
+ } else { \
+ conn.fd = -1; \
+ } \
SLURP_STRING(_##conn, remoteAddress, &conn.remote); \
SLURP_INT(_##conn, remotePort, &conn.port); \
SLURP_INT(_##conn, bufferSize, &conn.buffered);
Please sign in to comment.
Something went wrong with that request. Please try again.