SOURCES: cdcat-fstab.patch (NEW) - fixes segfault on full-of-white...

vip vip at pld-linux.org
Sat Sep 22 23:13:39 CEST 2007


Author: vip                          Date: Sat Sep 22 21:13:39 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fixes segfault on full-of-whitespaces fstab entries

---- Files affected:
SOURCES:
   cdcat-fstab.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/cdcat-fstab.patch
diff -u /dev/null SOURCES/cdcat-fstab.patch:1.1
--- /dev/null	Sat Sep 22 23:13:39 2007
+++ SOURCES/cdcat-fstab.patch	Sat Sep 22 23:13:34 2007
@@ -0,0 +1,35 @@
+--- src/misc.cpp.orig	2006-11-19 18:30:08.538643734 +0100
++++ src/misc.cpp	2006-11-19 18:34:41.635711234 +0100
+@@ -32,6 +32,7 @@
+    
+    QFile f("/etc/fstab");
+    QString line;
++   QRegExp separator("\\s+");
+ 
+    if (f.open(IO_ReadOnly)) 
+     {	// file opened successfully
+@@ -39,18 +40,15 @@
+ 
+      while (!t.eof()) 
+        {
+-         line = t.readLine();	// line of text excluding '\n'
++         line = t.readLine().simplifyWhiteSpace();	// line of text excluding '\n'
+ 	 
+          if(!line.startsWith("#") && !line.isEmpty()) 
+ 	   {
+-             if(((line.section("\t",1,1,QString::SectionSkipEmpty)).replace(QRegExp("/$"),"")).compare(cfgcdpath) == 0)
+-	       {
+-	        strcpy(devicename,(const char *)line.section("\t",0,0));
+-	       }     	
+-	     if(((line.section(" " ,1,1,QString::SectionSkipEmpty)).replace(QRegExp("/$"),"")).compare(cfgcdpath) == 0) 
+-	       {
+-	        strcpy(devicename,(const char *)line.section(" " ,0,0));	       
+-	       }
++		if(line.section(separator, 1, 1, QString::SectionSkipEmpty).compare(cfgcdpath) == 0)
++		{
++			strncpy(devicename, (const char *) line.section(separator, 0, 0), 63);
++			break;
++		}
+            } 
+        }
+      f.close();
================================================================


More information about the pld-cvs-commit mailing list