[PATCH] drivers/tty/hvc: using strlcpy instead of strncpy

Jiri Slaby jslaby at suse.cz
Fri Mar 1 00:47:08 EST 2013


On 02/28/2013 12:15 PM, Chen Gang wrote:
> 于 2013年02月28日 19:13, Chen Gang 写道:
>> 于 2013年02月28日 18:41, Jiri Slaby 写道:
>>> On 02/26/2013 04:43 AM, Chen Gang wrote:
>>>>>
>>>>>   when strlen pi->location_code is larger than HVCS_CLC_LENGTH + 1,
>>>>>     original implementation can not let hvcsd->p_location_code NUL terminated.
>>>>>   so need fix it (also can simplify the code)
>>> It should never be larger because the +1 is exactly for NUL. But it is a
>>> cleanup, so why not...
>>>
>>
>>   when strlen(&pi->location_code[0]) == HVCS_CLC_LENGTH + 2

It cannot, pi->location_code is defined as char[HVCS_CLC_LENGTH + 1].


-- 
js
suse labs


More information about the Linuxppc-dev mailing list