Package: zfs-fuse
Version: 0.7.0-2
Severity: important

zfs-fuse fails to start and either segfault or report an invalid long
option. Attached is a patch that initialize argv[O] in read_cfg, ie 
it currently point to unitialized memory and this memory is read when
there is an option passed to zfs-fuse.
I also comment the /etc/zfs/zfsrc argument as it seems it is not a valid
argument. 
Patch compile and run.

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.1.0test0 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages zfs-fuse depends on:
ii  fuse-utils   2.8.6-2       
ii  libaio1      0.3.109-2     
ii  libc6        2.13-21       
ii  libfuse2     2.8.6-2       
ii  libssl1.0.0  1.0.0e-2      
ii  lsb-base     3.2-28        
ii  zlib1g       1:1.2.5.dfsg-1

zfs-fuse recommends no packages.

Versions of packages zfs-fuse suggests:
ii  kpartx             0.4.9-2  
ii  nfs-kernel-server  1:1.2.5-2

-- no debconf information
Description: feed parse_args with the program name when using zfsrc
 Provide the program name as argv[0] as parse_args expect it to be there.
 Otherwise the with argv[argc++] item 0 of agrv points to uninitialized
 memory and random crashes or failure due to incorrect long_opts ensue.
 Also comment the /etc/zfs/zfsrc argv item as there is no such option and
 it breaks long_opts with error:
 "unrecognized option '--/etc/zfs/zfsrc'"

Author: Alban Browaeys <pra...@yahoo.com>

---

--- zfs-fuse-0.7.0.orig/src/zfs-fuse/main.c
+++ zfs-fuse-0.7.0/src/zfs-fuse/main.c
@@ -358,15 +358,18 @@ static void read_cfg() {
 		return;
 	while (!feof(f)) {
 		char buf[1024];
-		int argc = 0;
-		char *argv[10];
+		int argc = 1;
+		char *argv[11];
+
+		argv[0] = "zfs-fuse";
+
 		if (!fgets(buf,1024,f))
 			continue;
 		int l = strlen(buf)-1;
 		while (l >= 0 && buf[l] < 32)
 			buf[l--] = 0; // remove trailing cr (or any code < ' ')
 
-		argv[argc++] = "/etc/zfs/zfsrc";
+		//argv[argc++] = "/etc/zfs/zfsrc";
 
 		////////////////////////////////////////////
 		// more predictable parsing required

Reply via email to