You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_skipURL = _service->WebPrefix().length();
[CWE-197] V1029: Numeric Truncation Error. Return value of the 'length' function is written to the 8-bit variable.
In https://github.com/rdkcentral/rdkservices/blob/sprint/25Q1/WebKitBrowser/WebKitBrowser.h#L277 skipURL is declared as uint8_t datatype which is an unsigned int of 8 bits that can store a value ranging from 0 to 255. _
uint8_t _skipURL;
_skipURL value is received from the length of the string returned by _service->WebPrefix() method:
_skipURL = service->WebPrefix().length();
As per the code WebPrefix contains the string "/Service/WebKitBrowser" and the values of _skipURL and WebPrefix().length are 22 which is within the range value of uint8_t.
Probably we would never reach more than 255 value here but in theory service->WebPrefix().length() could return something higher when length() is size_t . If the string length exceeds 255 in the future, it could lead to truncation or unexpected behavior.
So wanted to address this warning with fix.
0 commit comments