summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoHyun Pyun <dh79.pyun@samsung.com>2020-01-23 13:09:38 +0900
committerDoHyun Pyun <dh79.pyun@samsung.com>2020-01-23 16:00:34 +0900
commit1b90b1af95c37504c0f4506f119d00233e706507 (patch)
tree149915b6e253eb981153d2679ffab75800cb8c4d
parent2f839e0d7b6263714b3a6926bea72317ee7f3b62 (diff)
downloadlibmtp-tizen_5.5_tv.tar.gz
libmtp-tizen_5.5_tv.tar.bz2
libmtp-tizen_5.5_tv.zip
Change-Id: I9f26480f9144c8f71fcab603af15018091274485 Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
-rwxr-xr-xpackaging/libmtp.spec2
-rwxr-xr-xsrc/libopenusb1-glue.c10
-rwxr-xr-xsrc/libusb-glue.c14
-rwxr-xr-xsrc/libusb1-glue.c14
4 files changed, 35 insertions, 5 deletions
diff --git a/packaging/libmtp.spec b/packaging/libmtp.spec
index a403f8b..401b8af 100755
--- a/packaging/libmtp.spec
+++ b/packaging/libmtp.spec
@@ -3,7 +3,7 @@
Name: libmtp
Summary: Library for media transfer protocol (mtp)
Version: 1.1.11
-Release: 12
+Release: 13
Group: Network & Connectivity/Other
License: LGPL-2.1
Source0: libmtp-%{version}.tar.gz
diff --git a/src/libopenusb1-glue.c b/src/libopenusb1-glue.c
index 1e04f04..8f670eb 100755
--- a/src/libopenusb1-glue.c
+++ b/src/libopenusb1-glue.c
@@ -1297,6 +1297,16 @@ static uint16_t ptp_usb_getpacket(PTPParams *params,
ret = ptp_read_func(packet_size, &memhandler, params->data, rlen, 0);
ptp_exit_recv_memory_handler(&memhandler, &x, rlen);
if (x) {
+ /*
+ * [DF200122-01357] Crash observed on accessing 360 camera via MTP .
+ */
+ if (*rlen > sizeof(PTPUSBBulkContainer)) {
+ libusb_glue_error(params,
+ "PTP: The packet size is so large");
+ free(x);
+ return PTP_RC_NoValidObjectInfo;
+ }
+
memcpy(packet, x, *rlen);
free(x);
}
diff --git a/src/libusb-glue.c b/src/libusb-glue.c
index 1b477a4..14daf53 100755
--- a/src/libusb-glue.c
+++ b/src/libusb-glue.c
@@ -1288,8 +1288,18 @@ static uint16_t ptp_usb_getpacket(PTPParams *params,
ret = ptp_read_func(packet_size, &memhandler, params->data, rlen, 0);
ptp_exit_recv_memory_handler (&memhandler, &x, rlen);
if (x) {
- memcpy (packet, x, *rlen);
- free (x);
+ /*
+ * [DF200122-01357] Crash observed on accessing 360 camera via MTP .
+ */
+ if (*rlen > sizeof(PTPUSBBulkContainer)) {
+ libusb_glue_error(params,
+ "PTP: The packet size is so large");
+ free(x);
+ return PTP_RC_NoValidObjectInfo;
+ }
+
+ memcpy(packet, x, *rlen);
+ free(x);
}
return ret;
}
diff --git a/src/libusb1-glue.c b/src/libusb1-glue.c
index 5c8c46a..c4527d2 100755
--- a/src/libusb1-glue.c
+++ b/src/libusb1-glue.c
@@ -1343,8 +1343,18 @@ static uint16_t ptp_usb_getpacket(PTPParams *params,
ret = ptp_read_func(packet_size, &memhandler, params->data, rlen, 0);
ptp_exit_recv_memory_handler (&memhandler, &x, rlen);
if (x) {
- memcpy (packet, x, *rlen);
- free (x);
+ /*
+ * [DF200122-01357] Crash observed on accessing 360 camera via MTP .
+ */
+ if (*rlen > sizeof(PTPUSBBulkContainer)) {
+ libusb_glue_error(params,
+ "PTP: The packet size is so large");
+ free(x);
+ return PTP_RC_NoValidObjectInfo;
+ }
+
+ memcpy(packet, x, *rlen);
+ free(x);
}
return ret;
}