From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot, for-v2014.10?] pxe: Ensure we don't overflow bootargs
Date: Fri, 10 Oct 2014 10:39:42 -0400 [thread overview]
Message-ID: <20141010143942.GS25506@bill-the-cat> (raw)
In-Reply-To: <1412342941-32498-1-git-send-email-ijc@hellion.org.uk>
On Fri, Oct 03, 2014 at 02:29:01PM +0100, Ian Campbell wrote:
> From: Ian Campbell <ian.campbell@citrix.com>
>
> On a couple of platforms I've tripped over long PXE append lines overflowing
> this array, due to having CONFIG_SYS_CBSIZE == 256. When doing preseeded Debian
> installs it's pretty trivial to exceed that.
>
> Since the symptom can be a silent hang or a crash add a check. Of course the
> affected boards would also need an increased CBSIZE to actually work.
>
> Note that due to the printing of the final bootargs string CONFIG_SYS_PBSIZE
> also needs to be sufficiently large.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
> I think this is v2014.10 material?
> ---
> common/cmd_pxe.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
> index 0ab1e0a..e63a031 100644
> --- a/common/cmd_pxe.c
> +++ b/common/cmd_pxe.c
> @@ -674,6 +674,15 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
> char bootargs[CONFIG_SYS_CBSIZE] = "";
> char finalbootargs[CONFIG_SYS_CBSIZE];
>
> + if (strlen(label->append ?: "") +
> + strlen(ip_str) + strlen(mac_str) + 1 > sizeof(bootargs)) {
> + printf("bootarg overflow %d+%d+%d+1 > %zd\n",
With a change to use %zd in all cases (aarch64 warns otherwise), applied
to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141010/8fe6e03e/attachment.pgp>
next prev parent reply other threads:[~2014-10-10 14:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-03 13:29 [U-Boot] [PATCH for-v2014.10?] pxe: Ensure we don't overflow bootargs Ian Campbell
2014-10-10 14:39 ` Tom Rini [this message]
2014-10-10 14:41 ` [U-Boot] [U-Boot, " Ian Campbell
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=20141010143942.GS25506@bill-the-cat \
--to=trini@ti.com \
--cc=u-boot@lists.denx.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox