Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-25 Thread Laszlo Ersek
On 04/22/16 20:52, Matt Fleming wrote: > On Thu, 21 Apr, at 06:21:11PM, Laszlo Ersek wrote: >> >> ... How about this instead? > > Your patch looks fine to me. I've gone ahead and stuck it in the > urgent EFI queue. I intended to probe for opinions first, and then (if appropriate) submit the

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-25 Thread Laszlo Ersek
On 04/22/16 20:52, Matt Fleming wrote: > On Thu, 21 Apr, at 06:21:11PM, Laszlo Ersek wrote: >> >> ... How about this instead? > > Your patch looks fine to me. I've gone ahead and stuck it in the > urgent EFI queue. I intended to probe for opinions first, and then (if appropriate) submit the

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-22 Thread Matt Fleming
On Thu, 21 Apr, at 06:21:11PM, Laszlo Ersek wrote: > > ... How about this instead? Your patch looks fine to me. I've gone ahead and stuck it in the urgent EFI queue. Thanks everyone!

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-22 Thread Matt Fleming
On Thu, 21 Apr, at 06:21:11PM, Laszlo Ersek wrote: > > ... How about this instead? Your patch looks fine to me. I've gone ahead and stuck it in the urgent EFI queue. Thanks everyone!

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-21 Thread Laszlo Ersek
On 04/21/16 14:18, Matt Fleming wrote: > ( Good Lord, I hate doing string manipulation in C ) > > On Wed, 20 Apr, at 03:25:32PM, Laszlo Ersek wrote: >> >> So, "len" does not include the room for the terminating NUL-byte here. >> When "len" is passed to ucs2_as_utf8(), with the proposed patch

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-21 Thread Laszlo Ersek
On 04/21/16 14:18, Matt Fleming wrote: > ( Good Lord, I hate doing string manipulation in C ) > > On Wed, 20 Apr, at 03:25:32PM, Laszlo Ersek wrote: >> >> So, "len" does not include the room for the terminating NUL-byte here. >> When "len" is passed to ucs2_as_utf8(), with the proposed patch

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-21 Thread Peter Jones
On Thu, Apr 21, 2016 at 01:18:27PM +0100, Matt Fleming wrote: > ( Good Lord, I hate doing string manipulation in C ) (yep) > > On Wed, 20 Apr, at 03:25:32PM, Laszlo Ersek wrote: > > > > So, "len" does not include the room for the terminating NUL-byte here. > > When "len" is passed to

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-21 Thread Peter Jones
On Thu, Apr 21, 2016 at 01:18:27PM +0100, Matt Fleming wrote: > ( Good Lord, I hate doing string manipulation in C ) (yep) > > On Wed, 20 Apr, at 03:25:32PM, Laszlo Ersek wrote: > > > > So, "len" does not include the room for the terminating NUL-byte here. > > When "len" is passed to

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-21 Thread Matt Fleming
( Good Lord, I hate doing string manipulation in C ) On Wed, 20 Apr, at 03:25:32PM, Laszlo Ersek wrote: > > So, "len" does not include the room for the terminating NUL-byte here. > When "len" is passed to ucs2_as_utf8(), with the proposed patch applied, > a NUL byte will be produced in "name",

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-21 Thread Matt Fleming
( Good Lord, I hate doing string manipulation in C ) On Wed, 20 Apr, at 03:25:32PM, Laszlo Ersek wrote: > > So, "len" does not include the room for the terminating NUL-byte here. > When "len" is passed to ucs2_as_utf8(), with the proposed patch applied, > a NUL byte will be produced in "name",

Re: [Intel-gfx] [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-20 Thread Jani Nikula
On Wed, 20 Apr 2016, Chris Wilson wrote: > If the caller, in this case efivarfs_callback(), only provides sufficent > room for the expanded utf8 and not enough to include the terminating NUL > byte, that NUL byte is skipped. When the caller then interprets it as a >

Re: [Intel-gfx] [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-20 Thread Jani Nikula
On Wed, 20 Apr 2016, Chris Wilson wrote: > If the caller, in this case efivarfs_callback(), only provides sufficent > room for the expanded utf8 and not enough to include the terminating NUL > byte, that NUL byte is skipped. When the caller then interprets it as a > string, it may then read from

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-20 Thread Laszlo Ersek
On 04/20/16 10:37, Chris Wilson wrote: > If the caller, in this case efivarfs_callback(), only provides sufficent > room for the expanded utf8 and not enough to include the terminating NUL > byte, that NUL byte is skipped. When the caller then interprets it as a > string, it may then read from

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-20 Thread Laszlo Ersek
On 04/20/16 10:37, Chris Wilson wrote: > If the caller, in this case efivarfs_callback(), only provides sufficent > room for the expanded utf8 and not enough to include the terminating NUL > byte, that NUL byte is skipped. When the caller then interprets it as a > string, it may then read from

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-20 Thread Laszlo Ersek
On 04/20/16 11:41, Chris Wilson wrote: > On Wed, Apr 20, 2016 at 11:36:37AM +0200, Laszlo Ersek wrote: >> On 04/20/16 10:37, Chris Wilson wrote: >>> If the caller, in this case efivarfs_callback(), only provides sufficent >>> room for the expanded utf8 and not enough to include the terminating NUL

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-20 Thread Laszlo Ersek
On 04/20/16 11:41, Chris Wilson wrote: > On Wed, Apr 20, 2016 at 11:36:37AM +0200, Laszlo Ersek wrote: >> On 04/20/16 10:37, Chris Wilson wrote: >>> If the caller, in this case efivarfs_callback(), only provides sufficent >>> room for the expanded utf8 and not enough to include the terminating NUL

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-20 Thread Chris Wilson
On Wed, Apr 20, 2016 at 11:36:37AM +0200, Laszlo Ersek wrote: > On 04/20/16 10:37, Chris Wilson wrote: > > If the caller, in this case efivarfs_callback(), only provides sufficent > > room for the expanded utf8 and not enough to include the terminating NUL > > byte, that NUL byte is skipped. > >

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-20 Thread Chris Wilson
On Wed, Apr 20, 2016 at 11:36:37AM +0200, Laszlo Ersek wrote: > On 04/20/16 10:37, Chris Wilson wrote: > > If the caller, in this case efivarfs_callback(), only provides sufficent > > room for the expanded utf8 and not enough to include the terminating NUL > > byte, that NUL byte is skipped. > >

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-20 Thread Laszlo Ersek
On 04/20/16 10:37, Chris Wilson wrote: > If the caller, in this case efivarfs_callback(), only provides sufficent > room for the expanded utf8 and not enough to include the terminating NUL > byte, that NUL byte is skipped. How does that occur? In efivarfs_callback() [fs/efivarfs/super.c], we have

Re: [PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-20 Thread Laszlo Ersek
On 04/20/16 10:37, Chris Wilson wrote: > If the caller, in this case efivarfs_callback(), only provides sufficent > room for the expanded utf8 and not enough to include the terminating NUL > byte, that NUL byte is skipped. How does that occur? In efivarfs_callback() [fs/efivarfs/super.c], we have

[PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-20 Thread Chris Wilson
If the caller, in this case efivarfs_callback(), only provides sufficent room for the expanded utf8 and not enough to include the terminating NUL byte, that NUL byte is skipped. When the caller then interprets it as a string, it may then read from past its allocated memory: [ 170.605647]

[PATCH] lib: Always NUL terminate ucs2_as_utf8

2016-04-20 Thread Chris Wilson
If the caller, in this case efivarfs_callback(), only provides sufficent room for the expanded utf8 and not enough to include the terminating NUL byte, that NUL byte is skipped. When the caller then interprets it as a string, it may then read from past its allocated memory: [ 170.605647]