- Fix all errors catched by cppcheck threadsafety (cppcheck --error-exitcode=0 --addon=threadsafety bbf)
- Fix some errors catched by cppcheck cert (cppcheck --error-exitcode=0 --addon=cert bbf)
- Add new str-protected macros instead of using str functions directly to avoid crashes
- remove unused argument from dmuci_add_section() and dmuci_add_section_bbfdm() functions
- use snprintf instead of dmasptintf
- change function name: add_list_paramameter -> add_list_parameter
- As per TR181, there could be one or more unique keys for each
multi-instance object. Added support to get the unique keys
associated with the multi-instance object.
- Changes for generate_source_code.sh to have unique keys as
extra object parameter.
Fixes snprintf truncated output compiler warnings.
Example:
--
../dmentrylibrary.c:31:38: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
31 | snprintf(buf, sizeof(buf), "%s/%s", folder_path, entry->d_name);
| ^
../dmentrylibrary.c:31:5: note: ‘snprintf’ output 2 or more bytes (assuming 257) into a destination of size 256
31 | snprintf(buf, sizeof(buf), "%s/%s", folder_path, entry->d_name);
--
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
This commit makes all symbols that are not part of the API Interface,
or used only in the object files where they are defined, static.
Causing the following benefits:
- The compiler can resolve functions for better performance
- The library size is decreased
NOTE: Spec file generators need to be adjusted for newer spec's to not do the same mistakes again
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
- use sysfs instread of ubus and ifconfig command execution for Inteface stats.
This reduces uneccessary memory and cpu overhead and speeds up the query time for
IP.Interface queries by a multiple.
- move redundant code to static functions
- fix rx/tx multicast/broadcast stats can never be obtained from ifconfig
- fix invalid stats for unknownprotopackets.
- fix stats not correclty reported when counters exceed 32bit int values.
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
- avoid uneccessary memory allocations
- move {read,write}FileContent functions to usb source file where they are used exclusively and make them static
- fix bad logic in readFileContent
- move redundant code to static functions
- fix get_USBUSBHostsHostDevice_MaxChildren never returning any value
- fix no interface instances being created
- make some functions that are not exported static
- fix segfault on get_USBInterface_Enable when the interface is down
- fix segfault on get_USBInterface_Status when the interface is down.
- fix segfault on missing format character in get_USBInterface_LowerLayers.
- fix segfault and double frees on recrusive browseUSBUSBHostsHostInst() calls.
- reduce overall memory usage
- use const on read-only values
- fix invalid comparision on strstr return value
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
- Fix Leaking on buffer allocation by using stack buffer
- Fix access on uninitalized and not zero terminated string returnd from
readlink()
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
Use unified function 'dmmap_file_path_get' and reuse it in
every function where the segfault occured.
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
- remove unused variables
- fix coding style of most function (Indentation, Tabulation, ..)
- check the source code using cppcheck tool
- change sprintf by snprintf