Hi,

While reviewing host_endian handling in the descriptor code
(for the BOS / ss-ep-comp desc support), I noticed something weird
in the wince code:

static int wince_get_device_descriptor(
    struct libusb_device *device,
    unsigned char *buffer, int *host_endian)
{
         struct wince_device_priv *priv = _device_priv(device);

         *host_endian = 1;
         memcpy(buffer, &priv->desc, DEVICE_DESC_LENGTH);
         return LIBUSB_SUCCESS;
}

So the device descriptor is in host endian format, that is possible,
but should likely be double checked.

static int wince_get_active_config_descriptor(
         struct libusb_device *device,
         unsigned char *buffer, size_t len, int *host_endian)
{
         struct wince_device_priv *priv = _device_priv(device);
         DWORD actualSize = len;
         *host_endian = 1;
         if (!UkwGetConfigDescriptor(priv->dev, UKW_ACTIVE_CONFIGURATION, buffer
                 return translate_driver_error(GetLastError());
         }
         return actualSize;
}

The config desc is in host_endian too? That is unlikely since it can
contain extensions which the OS knows nothing about, so atleast those
would need to be in raw format, as the OS would not know which
bytes to swap. Leading to a mess of some parts host_native and
some raw, so this is unlikely, and ...

static int wince_get_config_descriptor(
         struct libusb_device *device,
         uint8_t config_index,
         unsigned char *buffer, size_t len, int *host_endian)
{
         struct wince_device_priv *priv = _device_priv(device);
         DWORD actualSize = len;
         *host_endian = 0;
         if (!UkwGetConfigDescriptor(priv->dev, config_index, buffer, len, &actu
                 return translate_driver_error(GetLastError());
         }
         return actualSize;
}

This uses the same system call, but then all of a sudden things
are not host_endian ? Highly unlikely!

Regards,

Hans

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to