summaryrefslogtreecommitdiff
path: root/sys-fs/mtpfs/files/mtpfs-1.1-wking-patches/0003-Allocate-additional-byte-for-trailing-null.patch
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-fs/mtpfs/files/mtpfs-1.1-wking-patches/0003-Allocate-additional-byte-for-trailing-null.patch
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-fs/mtpfs/files/mtpfs-1.1-wking-patches/0003-Allocate-additional-byte-for-trailing-null.patch')
-rw-r--r--sys-fs/mtpfs/files/mtpfs-1.1-wking-patches/0003-Allocate-additional-byte-for-trailing-null.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/sys-fs/mtpfs/files/mtpfs-1.1-wking-patches/0003-Allocate-additional-byte-for-trailing-null.patch b/sys-fs/mtpfs/files/mtpfs-1.1-wking-patches/0003-Allocate-additional-byte-for-trailing-null.patch
new file mode 100644
index 000000000000..20cff00e32ee
--- /dev/null
+++ b/sys-fs/mtpfs/files/mtpfs-1.1-wking-patches/0003-Allocate-additional-byte-for-trailing-null.patch
@@ -0,0 +1,55 @@
+From 3929648c83910a45a37e84b4d3e5316631ce7c6b Mon Sep 17 00:00:00 2001
+From: "W. Trevor King" <wking@tremily.us>
+Date: Mon, 24 Aug 2015 00:08:24 -0700
+Subject: [PATCH 3/7] Allocate additional byte for trailing null
+
+These variables needs a byte for every character in the path and an
+additional trailing null, but the length returned by strlen excludes
+the trailing null.
+---
+ mtpfs.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/mtpfs.c b/mtpfs.c
+index bdd5f46..e31acd9 100644
+--- a/mtpfs.c
++++ b/mtpfs.c
+@@ -416,7 +416,7 @@ parse_path (const gchar * path)
+ LIBMTP_folder_t *folder;
+ gchar **fields;
+ gchar *directory;
+- directory = (gchar *) g_malloc (strlen (path));
++ directory = (gchar *) g_malloc (strlen (path) + 1);
+ directory = strcpy (directory, "");
+ fields = g_strsplit (path, "/", -1);
+ res = -ENOENT;
+@@ -488,7 +488,7 @@ mtpfs_release (const char *path, struct fuse_file_info *fi)
+ gchar *filename = g_strdup("");
+ gchar **fields;
+ gchar *directory;
+- directory = (gchar *) g_malloc (strlen (path));
++ directory = (gchar *) g_malloc (strlen (path) + 1);
+ directory = strcpy (directory, "/");
+ fields = g_strsplit (path, "/", -1);
+ int i;
+@@ -1089,7 +1089,7 @@ mtpfs_mkdir_real (const char *path, mode_t mode)
+ gchar **fields;
+ gchar *directory;
+
+- directory = (gchar *) g_malloc (strlen (path));
++ directory = (gchar *) g_malloc (strlen (path) + 1);
+ directory = strcpy (directory, "/");
+ fields = g_strsplit (path, "/", -1);
+ int i;
+@@ -1168,7 +1168,7 @@ mtpfs_rename (const char *oldname, const char *newname)
+ gchar *filename;
+ gchar **fields;
+ gchar *directory;
+- directory = (gchar *) g_malloc (strlen (newname));
++ directory = (gchar *) g_malloc (strlen (newname) + 1);
+ directory = strcpy (directory, "/");
+ fields = g_strsplit (newname, "/", -1);
+ int i;
+--
+2.5.3
+