diff options
author | michael-west <michael.west@ettus.com> | 2014-03-07 12:23:34 -0800 |
---|---|---|
committer | michael-west <michael.west@ettus.com> | 2014-03-07 12:23:34 -0800 |
commit | 62862ecc3ed4be097d09502d57d91543f3c41bf8 (patch) | |
tree | 63f8b475788bc68a7a83761eb28ab761df2e0cfe /host/lib/transport/nirio | |
parent | 973b47c48339dbae2e125a8c8d84ef67fedc4bdf (diff) | |
download | uhd-62862ecc3ed4be097d09502d57d91543f3c41bf8.tar.gz uhd-62862ecc3ed4be097d09502d57d91543f3c41bf8.tar.bz2 uhd-62862ecc3ed4be097d09502d57d91543f3c41bf8.zip |
Fix for Bug #378: rpc_client::call() dereferences NULL pointers
- Added check for empty data before write
Diffstat (limited to 'host/lib/transport/nirio')
-rw-r--r-- | host/lib/transport/nirio/rpc/rpc_client.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/host/lib/transport/nirio/rpc/rpc_client.cpp b/host/lib/transport/nirio/rpc/rpc_client.cpp index c16a844c1..32a40a576 100644 --- a/host/lib/transport/nirio/rpc/rpc_client.cpp +++ b/host/lib/transport/nirio/rpc/rpc_client.cpp @@ -133,9 +133,12 @@ const boost::system::error_code& rpc_client::call( CHAIN_BLOCKING_XFER( boost::asio::write(_socket, boost::asio::buffer(&_request.header, sizeof(_request.header))), sizeof(_request.header), status); - CHAIN_BLOCKING_XFER( - boost::asio::write(_socket, boost::asio::buffer(&(*_request.data.begin()), _request.data.size())), - _request.data.size(), status); + if (not _request.data.empty()) + { + CHAIN_BLOCKING_XFER( + boost::asio::write(_socket, boost::asio::buffer(&(*_request.data.begin()), _request.data.size())), + _request.data.size(), status); + } } catch (boost::exception&) { status = false; } |