Package: dosfstools
Version: 3.0.16-1
Tags: upstream patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch saucy

Hello,

Since dosfstools 3.0.16, the udisks2 test suite now fails with

  File "src/tests/integration-test", line 1001, in _do_udisks_check
    fs.call_set_label_sync('', no_options, None)
  File "/usr/lib/python3/dist-packages/gi/types.py", line 113, in function
    return info.invoke(*args, **kwargs)
gi._glib.GError: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error 
setting label: Command-line `dosfslabel "/dev/sdb" ""' exited with non-zero 
exit status 1: dosfslabel: labels cannot contain lower case characters

I can replicate this error on the command line:

  $ dd if=/dev/zero of=/tmp/i bs=1024 count=2000
  $ mkdosfs /tmp/i
  $ dosfslabel /tmp/i 'HELLO'
  $ dosfslabel /tmp/i ''
  dosfslabel: labels cannot contain lower case characters

This is because the check always reads 11 characters into argv[1],
regardless of the actual string length. git formatted patch against
upstream master attached.

Thanks,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
From 85a6cd1f62f6b31fb21ddea9e01da97e8c940e0d Mon Sep 17 00:00:00 2001
From: Martin Pitt <martinp...@gnome.org>
Date: Fri, 24 May 2013 09:35:44 +0200
Subject: [PATCH 3/3] dosfslabel: Do not read beyond string length

When checking whether the label contains any lower-case characters, do not read
beyond the end of the string.
---
 src/dosfslabel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dosfslabel.c b/src/dosfslabel.c
index dd8d36a..c87c834 100644
--- a/src/dosfslabel.c
+++ b/src/dosfslabel.c
@@ -115,7 +115,7 @@ int main(int argc, char *argv[])
 		    "dosfslabel: labels can be no longer than 11 characters\n");
 	    exit(1);
 	}
-        for (i = 0; i < 11; i++)
+        for (i = 0; label[i] && i < 11; i++)
           /* don't know if here should be more strict !uppercase(label[i])*/
           if (islower(label[i])) {
             fprintf(stderr,
-- 
1.8.1.2

Attachment: signature.asc
Description: Digital signature

Reply via email to