Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Unified Diff: patches/07_fix_strcpy_in_ptp_unpack_ptptime.patch

Issue 2364793002: Revert "Uprev libmtp to 1.1.12" (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libmtp@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « patches/04_parse_extension_descriptor_null_check.patch ('k') | patches/08_add_licenses.patch » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: patches/07_fix_strcpy_in_ptp_unpack_ptptime.patch
diff --git a/patches/07_fix_strcpy_in_ptp_unpack_ptptime.patch b/patches/07_fix_strcpy_in_ptp_unpack_ptptime.patch
new file mode 100644
index 0000000000000000000000000000000000000000..4e7f8e8ccc2d2ac1206aac91bf53594b5d3b77af
--- /dev/null
+++ b/patches/07_fix_strcpy_in_ptp_unpack_ptptime.patch
@@ -0,0 +1,27 @@
+Index: src/ptp-pack.c
+===================================================================
+--- src/ptp-pack.c (revision 148712)
++++ src/ptp-pack.c (working copy)
+@@ -533,7 +533,7 @@
+ ptp_unpack_PTPTIME (const char *str) {
+ char ptpdate[40];
+ char tmp[5];
+- int ptpdatelen;
++ size_t ptpdatelen;
+ struct tm tm;
+
+ if (!str)
+@@ -543,11 +543,12 @@
+ /*ptp_debug (params ,"datelen is larger then size of buffer", ptpdatelen, (int)sizeof(ptpdate));*/
+ return 0;
+ }
+- strcpy (ptpdate, str);
+ if (ptpdatelen<15) {
+ /*ptp_debug (params ,"datelen is less than 15 (%d)", ptpdatelen);*/
+ return 0;
+ }
++ strncpy (ptpdate, str, sizeof(ptpdate));
++ ptpdate[sizeof(ptpdate) - 1] = '\0';
+
+ memset(&tm,0,sizeof(tm));
+ strncpy (tmp, ptpdate, 4);
« no previous file with comments | « patches/04_parse_extension_descriptor_null_check.patch ('k') | patches/08_add_licenses.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698