aboutsummaryrefslogtreecommitdiff
path: root/lib/libusb/libusb20_ugen20.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_ugen20.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_ugen20.c')
-rw-r--r--lib/libusb/libusb20_ugen20.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libusb/libusb20_ugen20.c b/lib/libusb/libusb20_ugen20.c
index f9f36891a034..efcca63a2095 100644
--- a/lib/libusb/libusb20_ugen20.c
+++ b/lib/libusb/libusb20_ugen20.c
@@ -449,6 +449,8 @@ ugen20_get_config_desc_full(struct libusb20_device *pdev,
uint16_t len;
int error;
+ /* make sure memory is initialised */
+ memset(&cdesc, 0, sizeof(cdesc));
memset(&gen_desc, 0, sizeof(gen_desc));
gen_desc.ugd_data = &cdesc;
@@ -468,6 +470,10 @@ ugen20_get_config_desc_full(struct libusb20_device *pdev,
if (!ptr) {
return (LIBUSB20_ERROR_NO_MEM);
}
+
+ /* make sure memory is initialised */
+ memset(ptr, 0, len);
+
gen_desc.ugd_data = ptr;
gen_desc.ugd_maxlen = len;