Cmdline unit test calls several functions that use snprintf,
with NULL pointer as the destination buffer. This patch
eliminates these NULL pointer tests.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
/* test help function */
memset(&buf, 0, sizeof(buf));
- /* try null buf */
- ret = cmdline_get_help_etheraddr(NULL, NULL, sizeof(buf));
- if (ret != -1) {
- printf("Error: help function accepted null buffer!\n");
- return -1;
- }
-
/* coverage! */
ret = cmdline_get_help_etheraddr(NULL, buf, sizeof(buf));
if (ret < 0) {
return -1;
}
- /* try null buf */
- ret = cmdline_get_help_num((cmdline_parse_token_hdr_t*)&token, NULL, sizeof(buf));
- if (ret != -1) {
- printf("Error: help function accepted null buffer!\n");
- return -1;
- }
-
/* coverage! */
ret = cmdline_get_help_num((cmdline_parse_token_hdr_t*)&token, buf, sizeof(buf));
if (ret < 0) {
/* test help function */
- /* try null buf */
- ret = cmdline_get_help_portlist(NULL, NULL, sizeof(buf));
- if (ret != -1) {
- printf("Error: help function accepted null buffer!\n");
- return -1;
- }
-
/* coverage! */
ret = cmdline_get_help_portlist(NULL, buf, sizeof(buf));
if (ret < 0) {