On 10/29/11 02:21, walter harms wrote:
              /* We need the full path name to open the file */
>  -            strncpy(path_name, PCI_TXT_IDS_PATH, 256);
>  -            strncat(path_name, "/", 1);
>  -            strncat(path_name, direntry->d_name, (256 - strlen(path_name) - 
1));
>  +            strlcpy(path_name, PCI_TXT_IDS_PATH, sizeof(path_name));
>  +            strlcat(path_name, "/", sizeof(path_name));
>  +            strlcat(path_name, direntry->d_name, sizeof(path_name));
        hi Alan,
        to improve readablity (and no clue what  path_name actualy is):
        asprintf(&path_name,"%s/%s",PCI_TXT_IDS_PATH,direntry->d_name);

It's already allocated on the stack: char path_name[256]
so snprintf should be good enough, but yes, that's probably clearer to read.

--
        -Alan Coopersmith-        alan.coopersm...@oracle.com
         Oracle Solaris Platform Engineering: X Window System

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to