From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Tue, 15 Sep 2015 17:34:07 -0400 Subject: [U-Boot] [U-Boot, 1/2] FIX: env: import: hashtable: Prevent buffer overrun when importing environment from file In-Reply-To: <1442185024-14645-1-git-send-email-l.majewski@majess.pl> References: <1442185024-14645-1-git-send-email-l.majewski@majess.pl> Message-ID: <20150915213407.GN26226@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, Sep 14, 2015 at 12:57:03AM +0200, Lukasz Majewski wrote: > Lets consider following scenario: > - One uses echo -n "key=value" to define environment variable in a file (single variable) > - The file content is "key=value" without any terminating byte (e.g. 0x0a or > 0x0d). > - The file is loaded to u-boot non zero'ed RAM buffer (with load command). > - Then "env import -t -r $loadaddr $filesize" is executed. > - Due to lack of proper termination byte we have classical example of buffer > overrun. > > This patch prevents from this by allocating one extra byte than size and > explicitly null terminate it. > > There should be no change for normal env import operation after applying > this patch. > > Signed-off-by: Lukasz Majewski 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: