Skip to content

Commit

Permalink
Add a check for filtering negative values and returning 0
Browse files Browse the repository at this point in the history
  • Loading branch information
nivi-apple committed Apr 19, 2024
1 parent f671387 commit 96b68fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/platform/Darwin/UserDefaults.mm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ uint16_t getUserDefaultDnssdSRPTimeoutInMSecs()
{
NSUserDefaults * defaults = [[NSUserDefaults alloc] initWithSuiteName:kUserDefaultDomain];
NSInteger srpTimeoutValue = [defaults integerForKey:kSRPTimeoutInMsecsUserDefaultKey];
return (srpTimeoutValue < UINT16_MAX) ? static_cast<uint16_t>(srpTimeoutValue) : 0;
return (srpTimeoutValue > 0 && srpTimeoutValue < UINT16_MAX) ? static_cast<uint16_t>(srpTimeoutValue) : 0;
}

} // namespace DeviceLayer
Expand Down

0 comments on commit 96b68fe

Please sign in to comment.