lkml.org 
[lkml]   [2013]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] arch: parisc: kernel: using strlcpy() instead of strcpy()
On 05/30/2013 11:06 PM, Wang YanQing wrote:
> What about add
> boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
> to protect the following another strcpy?
>
> "
> strcpy(command_line, boot_command_line);
> "

If the 'dest' length is not less than COMMAND_LINE_SIZE, the strlcpy()
will copy 'COMMAND_LINE_SIZE - 1' contents, and always set '\0' in the end.

So the next strcpy() will be safe.


Thanks.
--
Chen Gang

Asianux Corporation


\
 
 \ /
  Last update: 2013-06-03 11:22    [W:0.065 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site