[PATCH 3/4] ARM: omap: barebox update nand xloadslots handler

Alexander Aring alex.aring at gmail.com
Tue May 13 02:46:45 PDT 2014


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



More information about the barebox mailing list