Re: [PATCH] drivers/tty/hvc: using strlcpy instead of strncpy
From: Jiri Slaby <hidden>
Date: 2013-02-28 13:47:16
From: Jiri Slaby <hidden>
Date: 2013-02-28 13:47:16
On 02/28/2013 12:15 PM, Chen Gang wrote:
于 2013年02月28日 19:13, Chen Gang 写道:quoted
于 2013年02月28日 18:41, Jiri Slaby 写道:quoted
On 02/26/2013 04:43 AM, Chen Gang wrote:quoted
quoted
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