Re: [hackers] [ubase] Ensure opts is null-terminated before calling strcat() || sin

From: Evan Gates <evan.gates_AT_gmail.com>
Date: Mon, 10 Feb 2014 11:10:23 -0800

Out of curiosity why not just calloc?
-emg

On Mon, Feb 10, 2014 at 11:07 AM, <git_AT_suckless.org> wrote:
> commit 471432a9e69cfa6df095089838f779b73e916ed4
> Author: sin <sin_AT_2f30.org>
> Date: Mon Feb 10 19:06:42 2014 +0000
>
> Ensure opts is null-terminated before calling strcat()
>
> diff --git a/insmod.c b/insmod.c
> index e175a1c..484c544 100644
> --- a/insmod.c
> +++ b/insmod.c
> _AT_@ -54,6 +54,7 @@ main(int argc, char *argv[])
> opts = malloc(plen);
> if (!opts)
> eprintf("malloc:");
> + memset(opts, 0, plen);
> for (i = 0; i < argc; i++) {
> strcat(opts, argv[i]);
> if (i + 1 < argc)
>
>
Received on Mon Feb 10 2014 - 20:10:23 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 10 2014 - 20:12:26 CET