mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Wadim Egorov <w.egorov@phytec.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/4] ARM: omap: barebox update nand xloadslots handler
Date: Tue, 13 May 2014 11:46:45 +0200	[thread overview]
Message-ID: <20140513094629.GA27037@omega> (raw)
In-Reply-To: <1399897462-21433-3-git-send-email-w.egorov@phytec.de>

Hi,

some hints about your string handling in this code...

On Mon, May 12, 2014 at 02:24:21PM +0200, Wadim Egorov wrote:
...
> +
> +	devfilecopy = (char *)malloc(strlen(data->devicefile));
> +	if (!devfilecopy) {
> +		pr_err("could not allocate enough memory: %s\n", errno_str());
> +		return errno;
> +	}
> +	strcpy(devfilecopy, data->devicefile);
possible buffer overflow detected. "strlen" returns length of string
excluding of the terminate null byte.

Just use xstrdup here.

- Alex

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2014-05-13  9:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-12 12:24 [PATCH 1/4] PCM051: Update RAM timings Wadim Egorov
2014-05-12 12:24 ` [PATCH 2/4] barebox: common: added new filetypes Wadim Egorov
2014-05-12 12:24 ` [PATCH 3/4] ARM: omap: barebox update nand xloadslots handler Wadim Egorov
2014-05-13  8:38   ` Sascha Hauer
2014-05-13  9:46   ` Alexander Aring [this message]
2014-05-12 12:24 ` [PATCH 4/4] phycore-am335x: Added bbu " Wadim Egorov
2014-05-12 14:13   ` Holger Schurig
2014-05-14  7:21 ` [PATCH 1/4] PCM051: Update RAM timings Sascha Hauer

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=20140513094629.GA27037@omega \
    --to=alex.aring@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=w.egorov@phytec.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