File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ Connection::Connection(const std::string &uri)
22
22
// "radio://*/80/2M/E7E7E7E7E7" -> auto-pick radio
23
23
// "radio://*/80/2M/*" -> broadcast/P2P sniffing on channel 80
24
24
25
- const std::regex uri_regex (" (usb:\\ /\\ /(\\ d+)|radio:\\ /\\ /(\\ d+|\\ *)\\ /(\\ d+)\\ /(250K|1M|2M)\\ /([a-fA-F0-9]{10} |\\ *)(\\ ?[\\ w=&]+)?)" );
25
+ const std::regex uri_regex (" (usb:\\ /\\ /(\\ d+)|radio:\\ /\\ /(\\ d+|\\ *)\\ /(\\ d+)\\ /(250K|1M|2M)\\ /([a-fA-F0-9]+ |\\ *)(\\ ?[\\ w=&]+)?)" );
26
26
std::smatch match;
27
27
if (!std::regex_match (uri, match, uri_regex)) {
28
28
std::stringstream sstr;
@@ -64,6 +64,13 @@ Connection::Connection(const std::string &uri)
64
64
} else if (match[5 ].str () == " 2M" ) {
65
65
impl_->datarate_ = Crazyradio::Datarate_2MPS;
66
66
}
67
+
68
+ // Address is represented by 40 bytes => 10 hex chars max
69
+ if (match[6 ].str ().length () > 10 ) {
70
+ std::stringstream sstr;
71
+ sstr << " Invalid uri (" << uri << " )!" ;
72
+ throw std::runtime_error (sstr.str ());
73
+ }
67
74
impl_->address_ = std::stoull (match[6 ].str (), nullptr , 16 );
68
75
69
76
// parse flags
You can’t perform that action at this time.
0 commit comments