[rhythmbox] removable-media: chop file extensions at 8 chars (bug #603261)
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] removable-media: chop file extensions at 8 chars (bug #603261)
- Date: Sat, 13 Mar 2010 14:17:58 +0000 (UTC)
commit 4051e272dd84d6f6da13db840b973917c1a369d0
Author: Jonathan Matthew <jonathan d14n org>
Date: Sat Mar 13 19:29:30 2010 +1000
removable-media: chop file extensions at 8 chars (bug #603261)
The iPod plugin was crashing on stupidly long file extensions, as
they overflowed the buffer used to construct the filename. To fix
this, we limit the file extension for files we're transferring to
removeable devices to 8 characters.
sources/rb-removable-media-source.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/sources/rb-removable-media-source.c b/sources/rb-removable-media-source.c
index b67477b..6d2284a 100644
--- a/sources/rb-removable-media-source.c
+++ b/sources/rb-removable-media-source.c
@@ -45,6 +45,9 @@
#include "rb-util.h"
#include "rb-file-helpers.h"
+/* arbitrary length limit for file extensions */
+#define EXTENSION_LENGTH_LIMIT 8
+
static void rb_removable_media_source_constructed (GObject *object);
static void rb_removable_media_source_dispose (GObject *object);
@@ -393,6 +396,11 @@ impl_paste (RBSource *source, GList *entries)
g_free (path);
}
+ /* make sure the extension isn't ludicrously long */
+ if (strlen (extension) > EXTENSION_LENGTH_LIMIT) {
+ extension[EXTENSION_LENGTH_LIMIT] = '\0';
+ }
+
dest = rb_removable_media_source_build_dest_uri (RB_REMOVABLE_MEDIA_SOURCE (source), entry, mimetype, extension);
if (dest == NULL) {
rb_debug ("could not create destination path for entry");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]