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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux