mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-30 05:56:12 +00:00
[Unit-tests] Fix possible overflows and an undefined variable in the test framework.
This commit is contained in:
parent
0f445e1ddd
commit
cced3e7f1b
@ -255,7 +255,7 @@ fctstr_safe_cpy(char *dst, char const *src, size_t num)
|
|||||||
#if defined(WIN32) && _MSC_VER >= 1400
|
#if defined(WIN32) && _MSC_VER >= 1400
|
||||||
strncpy_s(dst, num, src, _TRUNCATE);
|
strncpy_s(dst, num, src, _TRUNCATE);
|
||||||
#else
|
#else
|
||||||
strncpy(dst, src, num);
|
strncpy(dst, src, num - 1);
|
||||||
#endif
|
#endif
|
||||||
dst[num-1] = '\0';
|
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);
|
list->itm_list = (void**)malloc(sizeof(void*)*start_sz);
|
||||||
if ( list->itm_list == NULL )
|
if ( list->itm_list == NULL )
|
||||||
{
|
{
|
||||||
|
list->used_itm_num = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user