libftdi Archives

Subject: Re: [PATCH] avoid PATH_MAX/string copies usage

From: "Gerd v. Egidy" <gerd.von.egidy@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: Mike Frysinger <vapier@xxxxxxxxxx>
Date: Mon, 4 Jan 2010 10:52:03 +0100
Hi Mike,

> +                /* XXX: This doesn't handle symlinks/odd paths/etc... */
> +                const char *desc = description + 2;
> +                size_t len = strlen(bus->dirname);
> +                if (strncmp(desc, bus->dirname, len))
> +                    continue;
> +                desc += len;
> +                if (desc[0] != '/')
> +                    continue;
> +                ++desc;
> +                if (strcmp(desc, dev->filename))
> +                    continue;
> +                return ftdi_usb_open_dev(ftdi, dev);

that is indeed more elegant than using the buffer/snprintf approach.

Thanks for the patch.

Kind regards,

Gerd

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread
  • Re: [PATCH] avoid PATH_MAX/string copies usage, Gerd v. Egidy <=