aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/b100
diff options
context:
space:
mode:
authorBen Hilburn <ben.hilburn@ettus.com>2014-04-10 13:09:01 -0700
committerBen Hilburn <ben.hilburn@ettus.com>2014-04-10 13:09:01 -0700
commit21518ec2baf0026966e11f35400a75c98d625a7f (patch)
treedadd043d82ecfc71219f6539ae2266ef639a94f7 /host/lib/usrp/b100
parent58c07d5f6ca00671499b2b9bd11599d8bd012f65 (diff)
parentfa996034dd2e6bd3d87c2d95f127063e5ed0839f (diff)
downloaduhd-21518ec2baf0026966e11f35400a75c98d625a7f.tar.gz
uhd-21518ec2baf0026966e11f35400a75c98d625a7f.tar.bz2
uhd-21518ec2baf0026966e11f35400a75c98d625a7f.zip
Merge branch 'origin/b200/issue_418'
Fixing unsafe sscanf call.
Diffstat (limited to 'host/lib/usrp/b100')
-rw-r--r--host/lib/usrp/b100/b100_impl.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp
index cb32a596c..baf2b6ae3 100644
--- a/host/lib/usrp/b100/b100_impl.cpp
+++ b/host/lib/usrp/b100/b100_impl.cpp
@@ -20,6 +20,7 @@
#include "b100_regs.hpp"
#include <uhd/transport/usb_control.hpp>
#include <uhd/utils/msg.hpp>
+#include <uhd/utils/cast.hpp>
#include <uhd/exception.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/utils/images.hpp>
@@ -56,11 +57,11 @@ static device_addrs_t b100_find(const device_addr_t &hint)
//since an address and resource is intended for a different, non-USB, device.
if (hint.has_key("addr") || hint.has_key("resource")) return b100_addrs;
- unsigned int vid, pid;
+ boost::uint16_t vid, pid;
if(hint.has_key("vid") && hint.has_key("pid") && hint.has_key("type") && hint["type"] == "b100") {
- sscanf(hint.get("vid").c_str(), "%x", &vid);
- sscanf(hint.get("pid").c_str(), "%x", &pid);
+ vid = uhd::cast::hexstr_cast<boost::uint16_t>(hint.get("vid"));
+ pid = uhd::cast::hexstr_cast<boost::uint16_t>(hint.get("pid"));
} else {
vid = B100_VENDOR_ID;
pid = B100_PRODUCT_ID;