]> git.pld-linux.org Git - packages/cdcat.git/commitdiff
- fixes segfault on full-of-whitespaces fstab entries
authorvip <vip@pld-linux.org>
Sat, 22 Sep 2007 21:13:34 +0000 (21:13 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    cdcat-fstab.patch -> 1.1

cdcat-fstab.patch [new file with mode: 0644]

diff --git a/cdcat-fstab.patch b/cdcat-fstab.patch
new file mode 100644 (file)
index 0000000..3a0291e
--- /dev/null
@@ -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();
This page took 0.084762 seconds and 4 git commands to generate.