On Wed, Jun 20, 2018 at 07:51:11PM -0300, Breno Leitao wrote:
> -     strncpy(prog, argv[0], strlen(argv[0]));
> +     strncpy(prog, argv[0], sizeof(prog) - 1);

        strncpy(prog, argv[0], sizeof prog);
        if (prog[sizeof prog - 1])
                scream_bloody_murder();

Silently using the wrong data is a worse habit than not checking for
overflows ;-)


Segher

Reply via email to