Use reallocarray() in sc_vector
This fails safely in case of overflow.
This commit is contained in:
parent
6dceb32817
commit
c735b8c127
1 changed files with 1 additions and 1 deletions
|
@ -118,7 +118,7 @@ static inline void *
|
||||||
sc_vector_reallocdata_(void *ptr, size_t count, size_t size,
|
sc_vector_reallocdata_(void *ptr, size_t count, size_t size,
|
||||||
size_t *restrict pcap, size_t *restrict psize)
|
size_t *restrict pcap, size_t *restrict psize)
|
||||||
{
|
{
|
||||||
void *p = realloc(ptr, count * size);
|
void *p = reallocarray(ptr, count, size);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue