aboutsummaryrefslogtreecommitdiff
path: root/lib/libusb/libusb20_desc.c
diff options
context:
space:
mode:
authorAndrew Thompson <thompsa@FreeBSD.org>2009-11-08 20:03:52 +0000
committerAndrew Thompson <thompsa@FreeBSD.org>2009-11-08 20:03:52 +0000
commitccef4ddf40fee777575fe227405159a2b6d11dee (patch)
tree977c6deb1e9004ec847ecd42fbc6b89e7dc790cc /lib/libusb/libusb20_desc.c
parentf5a034f95a3eb1e4c66310499d671929d89b3b43 (diff)
downloadsrc-ccef4ddf40fee777575fe227405159a2b6d11dee.tar.gz
src-ccef4ddf40fee777575fe227405159a2b6d11dee.zip
- fix refcounting error during data transfer
- fix a memory leak on the USB backend - fix invalid pointer computations (in one case memory outside the allocated area was written in LibUSB v1.0) - make sure memory is always initialised, also in failing cases - add missing functions from v1.0.4 PR: usb/140325 Reported by: Robert Jenssen Submitted by: Hans Petter Selasky MFC After: 3 days
Notes
Notes: svn path=/head/; revision=199055
Diffstat (limited to 'lib/libusb/libusb20_desc.c')
-rw-r--r--lib/libusb/libusb20_desc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libusb/libusb20_desc.c b/lib/libusb/libusb20_desc.c
index e0d2c54b9080..5206cf457570 100644
--- a/lib/libusb/libusb20_desc.c
+++ b/lib/libusb/libusb20_desc.c
@@ -118,6 +118,9 @@ libusb20_parse_config_desc(const void *config_desc)
if (lub_config == NULL) {
return (NULL); /* out of memory */
}
+ /* make sure memory is initialised */
+ memset(lub_config, 0, size);
+
lub_interface = (void *)(lub_config + 1);
lub_alt_interface = (void *)(lub_interface + niface_no_alt);
lub_endpoint = (void *)(lub_interface + niface);