From: vip Date: Sat, 22 Sep 2007 21:13:34 +0000 (+0000) Subject: - fixes segfault on full-of-whitespaces fstab entries X-Git-Tag: svn~12 X-Git-Url: https://git.pld-linux.org/?p=packages%2Fcdcat.git;a=commitdiff_plain;h=981f7fb96454b1478449fbe20238f2db2db1b209;hp=3443b4aec0d06c3b718369a167ca6e77f911295d - fixes segfault on full-of-whitespaces fstab entries Changed files: cdcat-fstab.patch -> 1.1 --- diff --git a/cdcat-fstab.patch b/cdcat-fstab.patch new file mode 100644 index 0000000..3a0291e --- /dev/null +++ b/cdcat-fstab.patch @@ -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();