bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH 4/4] device/chario.c (char_write): avoid segmentation fault


From: Richard Braun
Subject: Re: [PATCH 4/4] device/chario.c (char_write): avoid segmentation fault
Date: Sat, 14 Dec 2013 12:45:32 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Dec 13, 2013 at 09:06:55PM +0100, Marin Ramesa wrote:
> Check if the source of the data in the source structure
> memory is a target structure data. Do this by comparing the 
> length of the char values starting with the source address until 
> null-termination to the size of the target structure. Start by 
> initializing the counter to the size of the first member in the 
> target structure. Then char values in memory are counted until 
> null-termination, and finally the counted result is compared to the 
> size of the target structure. If the values don't match, return from the 
> function.

I really don't see a problem in that code, you'll have to describe it
better. On the other hand, your patch relies on knowing the target
types, although vm_map_copy_t is explicitely described as being opaque.
In addition, you basically reimplement strlen inline, and I also don't
understand why you assume the data to be null-terminated.

-- 
Richard Braun



reply via email to

[Prev in Thread] Current Thread [Next in Thread]