[Unit-tests] Fix possible overflows and an undefined variable in the test framework.

This commit is contained in:
Andrey Volk 2023-07-24 16:20:20 +03:00
parent 0f445e1ddd
commit cced3e7f1b
1 changed files with 2 additions and 1 deletions

View File

@ -255,7 +255,7 @@ fctstr_safe_cpy(char *dst, char const *src, size_t num)
#if defined(WIN32) && _MSC_VER >= 1400
strncpy_s(dst, num, src, _TRUNCATE);
#else
strncpy(dst, src, num);
strncpy(dst, src, num - 1);
#endif
dst[num-1] = '\0';
}
@ -760,6 +760,7 @@ fct_nlist__init2(fct_nlist_t *list, size_t start_sz)
list->itm_list = (void**)malloc(sizeof(void*)*start_sz);
if ( list->itm_list == NULL )
{
list->used_itm_num = 0;
return 0;
}
}