Skip to content

Commit 43a3542

Browse files
committed
Set upper bounds for a few config params
1 parent 06d22f2 commit 43a3542

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

libraries/YarpPlugins/CuiAbsolute/DeviceDriverImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ bool CuiAbsolute::open(yarp::os::Searchable & config)
4242
timeout = cuiGroup.check("timeout", yarp::os::Value(DEFAULT_TIMEOUT), "timeout (seconds)").asFloat64();
4343
maxRetries = cuiGroup.check("maxRetries", yarp::os::Value(DEFAULT_MAX_RETRIES), "max retries on timeout").asFloat64();
4444

45-
if (canId <= 0)
45+
if (canId <= 0 || canId > 127)
4646
{
4747
yCError(CUI) << "Illegal CAN ID:" << canId;
4848
return false;

libraries/YarpPlugins/Jr3Mbed/DeviceDriverImpl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ bool Jr3Mbed::open(yarp::os::Searchable & config)
4242
name = config.check("name", yarp::os::Value(""), "sensor name").asString(); // id-specific
4343
filter = jr3Group.check("filter", yarp::os::Value(DEFAULT_FILTER), "cutoff frequency for low-pass filter (Hertz)").asFloat64();
4444

45-
if (canId <= 0)
45+
if (canId <= 0 || canId > 127)
4646
{
4747
yCError(JR3M) << "Illegal CAN ID:" << canId;
4848
return false;
4949
}
5050

51-
if (filter < 0.0)
51+
if (filter < 0.0 || filter > 655.35) // (2^16 - 1) / 100
5252
{
5353
yCError(JR3M) << "Illegal filter value:" << filter;
5454
return false;

0 commit comments

Comments
 (0)