ia64/linux-2.6.18-xen.hg

diff drivers/pci/guestdev.c @ 895:20be7f6d414a

pci/guestdev, iomul: use strlcpy()

use strlcpy() to make them robust.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 04 10:45:49 2009 +0100 (2009-06-04)
parents b998614e2e2a
children
line diff
     1.1 --- a/drivers/pci/guestdev.c	Thu Jun 04 10:33:52 2009 +0100
     1.2 +++ b/drivers/pci/guestdev.c	Thu Jun 04 10:45:49 2009 +0100
     1.3 @@ -104,8 +104,7 @@ static int __init pci_get_hid_uid(char *
     1.4  	if (len <= 0 || HID_LEN < len)
     1.5  		goto format_err_end;
     1.6  
     1.7 -	strncpy(hid, sp, len);
     1.8 -	hid[len] = '\0';
     1.9 +	strlcpy(hid, sp, len);
    1.10  
    1.11  	if (*ep == '-') { /* no uid */
    1.12  		uid[0] = '\0';
    1.13 @@ -122,8 +121,7 @@ static int __init pci_get_hid_uid(char *
    1.14  	if (len <= 0 || UID_LEN < len)
    1.15  		goto format_err_end;
    1.16  
    1.17 -	strncpy(uid, sp, len);
    1.18 -	uid[len] = '\0';
    1.19 +	strlcpy(uid, sp, len);
    1.20  	return TRUE;
    1.21  
    1.22  format_err_end:
    1.23 @@ -549,7 +547,7 @@ static int __init pci_guestdev_setup(cha
    1.24  {
    1.25  	if (strlen(str) >= COMMAND_LINE_SIZE)
    1.26  		return 0;
    1.27 -	strcpy(guestdev_param, str);
    1.28 +	strlcpy(guestdev_param, str, sizeof(guestdev_param));
    1.29  	return 1;
    1.30  }
    1.31