Ulrich Windl wrote:
> On 28 Jan 2009 at 22:49, Hans de Goede wrote:
> 
>> Hi,
>>
>> While testing I noticed that "iscsiadmin -m fw" does not work properly on 
>> newer 
>> (rawhide atleast) kernels, the attached patch (already applied to the Fedora 
>> devel packages) fixes this.
> 
> Hi!
> 
> I have almost no ideas on the implementation, but please see my comments:
> 
> diff -up open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c~ 
> open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c
> --- open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c~     
> 2009-01-28 22:09:21.000000000 +0100
> +++ open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c      
> 2009-01-28 22:10:29.000000000 +0100
> @@ -186,6 +186,40 @@ static int get_iface_from_device(const c
>               break;
>       }
>  
> +     closedir(dirfd);
> +
> +     if (rc != ENODEV)
> +             return rc;
> +
> +     /* If not found try again with newer kernel networkdev sysfs layout */
> +     strncat(dev_dir, "/net", FILENAMESZ);
> 
> What do you thing you gain by using "strncat(dev_dir, "/net", FILENAMESZ);" 
> instead of "strcat(dev_dir, "/net");"?
> 

Nothing I copied this from the existing code, assuming (wrong) the existing 
code was ok, which it is not. The idea is to protect against buffer overflows, 
but using strncat this way will not accomplish this.

> +
> +     if (!file_exist(dev_dir))
> +             return rc;
> +
> +     dirfd = opendir(dev_dir);
> +     if (!dirfd)
> +             return errno;
> +
> +     while ((dent = readdir(dirfd))) {
> +             if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
> +                     continue;
> +
> +             /* Take the first "regular" directory entry */
> +             if (strlen(dent->d_name) > (sizeof(context->iface) - 1)) {
> +                     rc = EINVAL;
> +                     printf("Net device %s too bug for iface buffer.\n",
> +                            dent->d_name);
> 
> What is "too bug"? "too long"?
> 

"too big", another piece I copied and pasted.

Regards,

Hams


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---

Reply via email to