Hi,

On Tue, Dec 31, 2019 at 10:47:28PM +0100, g...@suckless.org wrote:
> diff --git a/ed.c b/ed.c
> index b844e86..e998e81 100644
> --- a/ed.c
> +++ b/ed.c
> @@ -204,7 +204,7 @@ makeline(char *s, int *off)
>       if (lastidx >= idxsize) {
>               lp = NULL;
>               if (idxsize <= SIZE_MAX - NUMLINES)
> -                 lp = realloc(zero, (idxsize + NUMLINES) * sizeof(*lp));
> +                 lp = reallocarray(zero, idxsize + NUMLINES, sizeof(*lp));

reallocarray is not a posix function, so it shouldn't be used here. If you
don't fell confortable using realloc due to the possibility of overflow then
you should add an explicit check against it.

Regards,

Reply via email to