Your message dated Mon, 12 Nov 2007 05:22:51 +0000
with message-id <[EMAIL PROTECTED]>
and subject line Bug#450651: fixed in libmtp 0.2.3-2
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: mtp-tools
Version: 0.2.2-2
Tags: patch

The example code which comes with libmtp and which is used to create
the command-line tools in the mtp-tools package uses atoi(3) for some
of its command-line parsing, which has problems if the file ids on the
mtp device are greater than INT_MAX.  I managed to crash my mp3 player
by making a playlist with bad data because of this bug.

I've patched the utils to use strtoul instead, and the rebuilt package
is working great here, so I'm sending you the patch.  You may want to
forward this to upstream as well.

My patch also fixes a few (though not all) minor memory leaks.
Apparently someone didn't realize that strdup(3) calls malloc(3).
These leaks are probably mostly harmless, since the programs exit
after doing their work, which frees all the leaked memory, but as a
matter of general principle, I tried to fix the most obvious ones I
spotted.  If you'd prefer, I can send you a trimmed-down patch which
only fixes the signed/unsigned problems.

cheers
-- 
Chris Waters           |  Pneumonoultra-        osis is too long
[EMAIL PROTECTED]       |  microscopicsilico-    to fit into a single
or [EMAIL PROTECTED] |  volcaniconi-          standalone haiku
diff -ur libmtp-0.2.2.old/examples/albumart.c libmtp-0.2.2/examples/albumart.c
--- libmtp-0.2.2.old/examples/albumart.c        2007-03-28 23:00:40.000000000 
-0700
+++ libmtp-0.2.2/examples/albumart.c    2007-11-07 22:48:24.000000000 -0800
@@ -43,6 +43,7 @@
   char *imagedata = NULL;
   char *albumname = NULL;
   char *path = NULL;
+  char *rest;
   struct stat statbuff;
 
   fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n");
@@ -58,7 +59,7 @@
         return 1;
       }
       ids = tmp;
-      ids[(idcount-1)] = atoi(strdup(optarg));
+      ids[(idcount-1)] = strtoul(optarg, &rest, 0);
       break;
     case 'n':
       albumname = strdup(optarg);
diff -ur libmtp-0.2.2.old/examples/newplaylist.c 
libmtp-0.2.2/examples/newplaylist.c
--- libmtp-0.2.2.old/examples/newplaylist.c     2007-03-28 23:00:41.000000000 
-0700
+++ libmtp-0.2.2/examples/newplaylist.c 2007-11-07 22:46:39.000000000 -0800
@@ -39,6 +39,7 @@
   uint32_t *ids = NULL;
   uint32_t *tmp = NULL;
   char *playlistname = NULL;
+  char *rest;
  
   fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n");
 
@@ -53,7 +54,7 @@
         return 1;
       }
       ids = tmp;
-      ids[(idcount-1)] = atoi(strdup(optarg));
+      ids[(idcount-1)] = strtoul(optarg, &rest, 0);
       break;
     case 'n':
       playlistname = strdup(optarg);
diff -ur libmtp-0.2.2.old/examples/pathutils.c libmtp-0.2.2/examples/pathutils.c
--- libmtp-0.2.2.old/examples/pathutils.c       2007-03-16 08:19:44.000000000 
-0700
+++ libmtp-0.2.2/examples/pathutils.c   2007-11-07 22:58:01.000000000 -0800
@@ -56,9 +56,11 @@
 int
 parse_path (char * path, LIBMTP_file_t * files, LIBMTP_folder_t * folders)
 {
+  char *rest;
   // Check if path is an item_id
   if (*path != '/') {
-    int item_id = atoi(path);
+    int item_id = strtoul(path, &rest, 0);
+    // really should check contents of "rest" here...
     return item_id;
   }
   // Check if path is a folder
@@ -83,11 +85,13 @@
       if (file->parent_id == parent_id) {
         if (strcasecmp (file->filename, filename) == 0) {
           int item_id = file->item_id;
+         free(dirc); free(basec);
           return item_id;
         }
       }
       file = file->next;
     }
+    free(dirc); free(basec);
   } else {
     return item_id;
   }
diff -ur libmtp-0.2.2.old/examples/thumb.c libmtp-0.2.2/examples/thumb.c
--- libmtp-0.2.2.old/examples/thumb.c   2007-03-28 23:00:41.000000000 -0700
+++ libmtp-0.2.2/examples/thumb.c       2007-11-07 23:02:36.000000000 -0800
@@ -41,6 +41,7 @@
   uint64_t filesize;
   uint8_t *imagedata = NULL;
   char *path = NULL;
+  char *rest;
   struct stat statbuff;
   int ret;
 
@@ -51,7 +52,7 @@
     case 'h':
       usage();
     case 'i':
-      id = atoi(strdup(optarg));
+      id = strtoul(optarg, &rest, 0);
       break;
     default:
       usage();

--- End Message ---
--- Begin Message ---
Source: libmtp
Source-Version: 0.2.3-2

We believe that the bug you reported is fixed in the latest version of
libmtp, which is due to be installed in the Debian FTP archive:

libmtp-dev_0.2.3-2_i386.deb
  to pool/main/libm/libmtp/libmtp-dev_0.2.3-2_i386.deb
libmtp-doc_0.2.3-2_all.deb
  to pool/main/libm/libmtp/libmtp-doc_0.2.3-2_all.deb
libmtp7_0.2.3-2_i386.deb
  to pool/main/libm/libmtp/libmtp7_0.2.3-2_i386.deb
libmtp_0.2.3-2.diff.gz
  to pool/main/libm/libmtp/libmtp_0.2.3-2.diff.gz
libmtp_0.2.3-2.dsc
  to pool/main/libm/libmtp/libmtp_0.2.3-2.dsc
mtp-tools_0.2.3-2_i386.deb
  to pool/main/libm/libmtp/mtp-tools_0.2.3-2_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [EMAIL PROTECTED],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Rafael Laboissiere <[EMAIL PROTECTED]> (supplier of updated libmtp package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [EMAIL PROTECTED])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Mon, 29 Oct 2007 23:16:08 +0100
Source: libmtp
Binary: libmtp-dev libmtp7 mtp-tools libmtp-doc
Architecture: source i386 all
Version: 0.2.3-2
Distribution: experimental
Urgency: low
Maintainer: Rafael Laboissiere <[EMAIL PROTECTED]>
Changed-By: Rafael Laboissiere <[EMAIL PROTECTED]>
Description: 
 libmtp-dev - Media Transfer Protocol (MTP) development files
 libmtp-doc - Media Transfer Protocol (MTP) library documentation
 libmtp7    - Media Transfer Protocol (MTP) library
 mtp-tools  - Media Transfer Protocol (MTP) library tools
Closes: 450651
Changes: 
 libmtp (0.2.3-2) experimental; urgency=low
 .
   * debian/patches/01_strtoul-mtp-command.patch: Added patch for using
     strtoul instead of atoi when parsing the command-line arguments of
     mtp-tools commands.  This avoids crashes when file ids on the mtp
     device are greater than INT_MAX.  (Closes: #450651, thanks to Chris
     Waters.)
 .
   * debian/control: Use the now official Vcs-* fields instead of the
     obsolete XS-Vcs-*
Files: 
 4155e7ea5c578afa4e69adcd5ea853fa 844 libs optional libmtp_0.2.3-2.dsc
 59532bfe182e0ea9e07caf622f17b114 7026 libs optional libmtp_0.2.3-2.diff.gz
 fa31caed89026022270942e93f39fba2 187802 doc optional libmtp-doc_0.2.3-2_all.deb
 47d652ab638b5fe255a569ecdef3d3e4 103120 libs optional libmtp7_0.2.3-2_i386.deb
 e1bc0edab53cd92ea7124264956d6ca4 102514 libdevel optional 
libmtp-dev_0.2.3-2_i386.deb
 3a14f7326c3899969c118cad435d260e 64540 utils optional 
mtp-tools_0.2.3-2_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHNsi+k3oga0pdcv4RAlGPAJ9FX5eCgpbJGwkUyqGN2jJ6Isw7OgCfSb5G
ZOZHq+CRdTNzkFlWx+pwxD4=
=HllI
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to