tags 627097 + patch
tags 627097 + pending
thanks

Dear maintainer,

I've prepared an NMU for cryptkeeper (versioned as 0.9.5-1.1) and
uploaded it to DELAYED/7. Please feel free to tell me if I
should delay it longer.

Regards.
diff -Nru cryptkeeper-0.9.5/debian/changelog cryptkeeper-0.9.5/debian/changelog
--- cryptkeeper-0.9.5/debian/changelog	2011-05-18 14:28:38.000000000 +0100
+++ cryptkeeper-0.9.5/debian/changelog	2011-05-23 11:45:22.000000000 +0100
@@ -1,3 +1,11 @@
+cryptkeeper (0.9.5-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Change is_mounted_overflow_fix.patch, original was bad,
+    sorry. Closes: #627097.
+
+ -- Jon Dowland <j...@debian.org>  Mon, 23 May 2011 10:34:07 +0100
+
 cryptkeeper (0.9.5-1) unstable; urgency=low
 
   [ Francesco Namuri ]
diff -Nru cryptkeeper-0.9.5/debian/patches/is_mounted_overflow_fix.patch cryptkeeper-0.9.5/debian/patches/is_mounted_overflow_fix.patch
--- cryptkeeper-0.9.5/debian/patches/is_mounted_overflow_fix.patch	2011-05-18 14:28:41.000000000 +0100
+++ cryptkeeper-0.9.5/debian/patches/is_mounted_overflow_fix.patch	2011-05-23 11:45:14.000000000 +0100
@@ -1,34 +1,51 @@
+commit 86b960a528df7118ab43b629bbd906db7459300d
+Author: Jon Dowland <j...@debian.org>
+Date:   Sun May 22 12:48:39 2011 +0100
+
+    fix is_mounted (memory leaks and NULL access)
+    
+    Ensure that the return of realpath is checked for NULL before
+    access.  Ensure that the return value is free'd before it falls
+    out of scope.  Related tidying up.
+
 diff --git a/src/encfs_wrapper.cpp b/src/encfs_wrapper.cpp
-index 347337b..7ae9cfe 100644
+index 347337b..961818b 100644
 --- a/src/encfs_wrapper.cpp
 +++ b/src/encfs_wrapper.cpp
-@@ -31,6 +31,8 @@
- // only for the gettext _
- #include "cryptkeeper.h"
+@@ -33,24 +33,24 @@
  
-+#define MIN(x,y) ((x) < (y) ? (x) : (y))
-+
  bool is_mounted(const char *mount_dir)
  {
++	struct mntent *m;
  	FILE *f = setmntent("/etc/mtab", "r");
-@@ -42,15 +44,21 @@ bool is_mounted(const char *mount_dir)
+- 	char *mount_dir_expanded = realpath(mount_dir, NULL);
+-	if (mount_dir_expanded == NULL) {
+-		// no such file or dir, ...
+-		// so: not mounted
+-		//	  perror("cryptkeeper, is_mounted");
++ 	char *mount_dir_expanded, *mnt_dir_expanded;
++
++	if (!(mount_dir_expanded = realpath(mount_dir, NULL)))
  		return false;
- 	}
- 	for (;;) {
-+		size_t srclen, dstlen;
-  	        char *mnt_dir_expanded;
- 		struct mntent *m = getmntent(f);
- 		if (!m) break;
-  		mnt_dir_expanded = realpath(m->mnt_dir, NULL);
+-	}
+-	for (;;) {
+- 	        char *mnt_dir_expanded;
+-		struct mntent *m = getmntent(f);
+-		if (!m) break;
+- 		mnt_dir_expanded = realpath(m->mnt_dir, NULL);
 - 		if (strcmp(mount_dir_expanded, mnt_dir_expanded)==0) {
-+		srclen = strlen(mount_dir_expanded);
-+		dstlen = strlen(mnt_dir_expanded);
-+ 		if (strncmp(mount_dir_expanded, mnt_dir_expanded, MIN(srclen,dstlen))==0) {
++
++	while(m = getmntent(f)) {
++ 	        if(mnt_dir_expanded = realpath(m->mnt_dir, NULL)) {
++			if (strcmp(mount_dir_expanded, mnt_dir_expanded)==0) {
++				free(mnt_dir_expanded);
++				free(mount_dir_expanded);
++				return true;
++			}
  			free(mnt_dir_expanded);
-+			free(mount_dir_expanded);
-  			return true;
-  		}
-+		free(mnt_dir_expanded);
+- 			return true;
+- 		}
++		}
  	}
 +	free(mount_dir_expanded);
  	return false;

Reply via email to