From: Segher Boessenkool <segher@kernel.crashing.org>
To: Breno Leitao <leitao@debian.org>
Cc: linuxppc-dev@lists.ozlabs.org,
Anshuman Khandual <khandual@linux.vnet.ibm.com>
Subject: Re: [PATCH] selftests/powerpc: Fix strncpy usage
Date: Thu, 21 Jun 2018 18:18:56 -0500 [thread overview]
Message-ID: <20180621231856.GO16221@gate.crashing.org> (raw)
In-Reply-To: <1529535071-14555-1-git-send-email-leitao@debian.org>
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
next prev parent reply other threads:[~2018-06-21 23:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-20 22:51 [PATCH] selftests/powerpc: Fix strncpy usage Breno Leitao
2018-06-21 23:18 ` Segher Boessenkool [this message]
2018-06-22 14:43 ` Breno Leitao
2018-06-22 14:51 ` Christophe LEROY
2018-06-23 1:00 ` Segher Boessenkool
2018-06-22 15:15 ` Paul Clarke
2018-06-22 21:01 ` Al Dunsmuir
2018-06-23 1:10 ` Segher Boessenkool
2018-06-25 21:21 ` Breno Leitao
2018-06-25 21:30 ` [PATCH v2] " Breno Leitao
2018-06-26 5:24 ` Michael Ellerman
2018-06-26 13:13 ` Breno Leitao
2018-06-26 13:20 ` [PATCH v3 1/2] " Breno Leitao
2018-06-26 13:20 ` [PATCH v3 2/2] selftests/powerpc: Fix typos Breno Leitao
2018-07-11 13:24 ` [v3,1/2] selftests/powerpc: Fix strncpy usage Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180621231856.GO16221@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=khandual@linux.vnet.ibm.com \
--cc=leitao@debian.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.