Index: kdeutils/config.h.bot diff -u kdeutils/config.h.bot:1.6 kdeutils/config.h.bot:1.6.6.1 --- kdeutils/config.h.bot:1.6 Fri Oct 13 22:27:32 2000 +++ kdeutils/config.h.bot Thu Jan 17 12:04:58 2002 @@ -24,3 +24,20 @@ #if defined(_AIX) #include #endif + +#ifndef HAVE_SETENV +#define HAVE_SETENV +#ifdef __cplusplus +extern "C" +#endif +int setenv(const char *name, const char *value, int overwrite); +#endif + +#ifndef HAVE_UNSETENV +#define HAVE_UNSETENV +#ifdef __cplusplus +extern "C" +#endif +int unsetenv(const char *name); +#endif + Index: kdeutils/ark/arch.cpp diff -u kdeutils/ark/arch.cpp:1.35 kdeutils/ark/arch.cpp:1.35.2.1 --- kdeutils/ark/arch.cpp:1.35 Tue Jul 17 20:46:06 2001 +++ kdeutils/ark/arch.cpp Fri Dec 13 11:48:11 2002 @@ -488,7 +488,7 @@ { strcpy(fourDigits, "20"); } - strcat(fourDigits, strYear); + strncat(fourDigits, strYear, sizeof(fourDigits)-strlen(fourDigits)-1); return fourDigits; } Index: kdeutils/ark/compressedfile.cc diff -u kdeutils/ark/compressedfile.cc:1.17 kdeutils/ark/compressedfile.cc:1.17.2.2 --- kdeutils/ark/compressedfile.cc:1.17 Tue Jul 17 20:46:06 2001 +++ kdeutils/ark/compressedfile.cc Fri Dec 6 17:32:17 2002 @@ -28,6 +28,9 @@ // C includes #include #include +#include +#include +#include // Qt includes #include @@ -129,7 +132,7 @@ // (that code is in the slot slotOpenDone) QString command; - command = "cp '" + m_filename + "' " + m_tmpdir; + command = "cp " + KShellProcess::quote(m_filename) + " " + KShellProcess::quote(m_tmpdir); system(QFile::encodeName(command)); m_tmpfile = m_filename.right(m_filename.length() @@ -192,15 +195,14 @@ kdDebug(1601) << "Temp file is " << m_tmpfile << endl; chdir(QFile::encodeName(m_tmpdir)); QString command = "ls -l " + - m_tmpfile.right(m_tmpfile.length() - 1 - m_tmpfile.findRev("/")); - + KShellProcess::quote(m_tmpfile.right(m_tmpfile.length() - 1 - m_tmpfile.findRev("/"))); char line[4096]; char columns[7][80]; char filename[4096]; FILE *readHandle = popen(QFile::encodeName(command), "r"); - fscanf(readHandle, "%[-A-Za-z:0-9_+-. ]", line); - sscanf(line, "%[-drwxst] %[0-9] %[0-9.a-zA-Z_] %[0-9.a-zA-Z_] %[0-9] %12[A-Za-z0-9: ]%1[ ]%[^\n]", columns[0], columns[5], + fscanf(readHandle, "%4095[-A-Za-z:0-9_+-. ]", line); + sscanf(line, "%79[-drwxst] %79[0-9] %79[0-9.a-zA-Z_] %79[0-9.a-zA-Z_] %79[0-9] %12[A-Za-z0-9: ]%1[ ]%79[^\n]", columns[0], columns[5], columns[1], columns[2], columns[3], columns[4], columns[6], filename); @@ -247,7 +249,7 @@ file = file.right(file.length() - 5); QString command; - command = "cp '" + file + "' " + m_tmpdir; + command = "cp " + KShellProcess::quote(file) + " " + KShellProcess::quote(m_tmpdir); system(QFile::encodeName(command)); m_tmpfile = file.right(file.length() @@ -311,8 +313,7 @@ dest = m_settings->getExtractDir(); else dest=_destDir; - QString command; - command = QString::fromLocal8Bit("cp %1 %2").arg(m_tmpfile).arg(dest); + QString command = "cp " + KShellProcess::quote(m_tmpfile) + " " + KShellProcess::quote(dest); system(QFile::encodeName(command)); } emit sigExtract(true); @@ -326,8 +327,8 @@ // delete the compressed file but then create it empty in case someone // does a reload and finds it no longer exists! unlink(QFile::encodeName(m_filename)); - QString command = "touch '" + m_filename + "'"; - system(QFile::encodeName(command)); + + ::close(::open(QFile::encodeName(m_filename), O_WRONLY | O_CREAT | O_EXCL)); m_tmpfile = ""; emit sigDelete(true); Index: kdeutils/ark/lha.cc diff -u kdeutils/ark/lha.cc:1.25 kdeutils/ark/lha.cc:1.25.2.2 --- kdeutils/ark/lha.cc:1.25 Wed May 30 15:16:24 2001 +++ kdeutils/ark/lha.cc Fri Dec 13 11:48:11 2002 @@ -74,7 +74,7 @@ if (QString(_line).contains("[generic]") ) { - sscanf(_line, " %[]\[generic] %[0-9] %[0-9] %[0-9.%*] %10[-a-z0-9 ] %3[A-Za-z]%1[ ]%2[0-9 ]%1[ ]%5[ 0-9:]%1[ ]%[^\n]", + sscanf(_line, " %79[]\\[generic] %79[0-9] %79[0-9] %79[0-9.%*] %10[-a-z0-9 ] %3[A-Za-z]%1[ ]%2[0-9 ]%1[ ]%5[ 0-9:]%1[ ]%4095[^\n]", columns[0], columns[2], columns[3], columns[4], columns[5], columns[6], columns[10], columns[7], columns[11], columns[8], columns[9], filename ); @@ -83,7 +83,7 @@ else if (QString(_line).contains("[MS-DOS]") ) { - sscanf(_line, " %[]\[MS-DOS] %[0-9] %[0-9] %[0-9.%*] %10[-a-z0-9 ] %3[A-Za-z]%1[ ]%2[0-9 ]%1[ ]%5[ 0-9:]%1[ ]%[^\n]", + sscanf(_line, " %79[]\\[MS-DOS] %79[0-9] %79[0-9] %79[0-9.%*] %10[-a-z0-9 ] %3[A-Za-z]%1[ ]%2[0-9 ]%1[ ]%5[ 0-9:]%1[ ]%4095[^\n]", columns[0], columns[2], columns[3], columns[4], columns[5], columns[6], columns[10], columns[7], columns[11], columns[8], columns[9], filename ); @@ -91,7 +91,7 @@ } else { - sscanf(_line, " %[-drlwxst] %[0-9/] %[0-9] %[0-9] %[0-9.%*] %10[-a-z0-9 ] %3[A-Za-z]%1[ ]%2[0-9 ]%1[ ]%5[ 0-9:]%1[ ]%[^\n]", + sscanf(_line, " %79[-drlwxst] %79[0-9/] %79[0-9] %79[0-9] %79[0-9.%*] %10[-a-z0-9 ] %3[A-Za-z]%1[ ]%2[0-9 ]%1[ ]%5[ 0-9:]%1[ ]%4095[^\n]", columns[0], columns[1], columns[2], columns[3], columns[4], columns[5], columns[6], columns[10], columns[7], columns[11], columns[8], columns[9], filename); @@ -102,7 +102,8 @@ // make the time stamp sortable QString massagedTimeStamp = Utils::getTimeStamp(columns[6], columns[7], columns[8]); - strcpy(columns[6], massagedTimeStamp.ascii()); + strncpy(columns[6], massagedTimeStamp.ascii(), sizeof(columns[6])); + columns[6][sizeof(columns[6])-1] = '\0'; kdDebug(1601) << "New timestamp is " << columns[6] << endl; Index: kdeutils/ark/rar.cc diff -u kdeutils/ark/rar.cc:1.17 kdeutils/ark/rar.cc:1.17.2.2 --- kdeutils/ark/rar.cc:1.17 Fri Feb 23 19:46:10 2001 +++ kdeutils/ark/rar.cc Fri Dec 13 11:48:11 2002 @@ -85,8 +85,8 @@ char columns[11][80]; char filename[4096]; - sscanf(QFile::encodeName(m_line1), " %[^\n]", filename); - sscanf((const char *)m_line2.ascii(), " %[0-9] %[0-9] %[0-9%] %2[0-9]-%2[0-9]-%2[0-9] %5[0-9:] %[drwxlst-] %[A-F0-9] %[A-Za-z0-9] %[0-9.]", + sscanf(QFile::encodeName(m_line1), " %4095[^\n]", filename); + sscanf((const char *)m_line2.ascii(), " %79[0-9] %79[0-9] %79[0-9%] %2[0-9]-%2[0-9]-%2[0-9] %5[0-9:] %79[drwxlst-] %79[A-F0-9] %79[A-Za-z0-9] %79[0-9.]", columns[0], columns[1], columns[2], columns[3], columns[8], columns[9], columns[10], columns[4], columns[5], columns[6], @@ -107,7 +107,8 @@ kdDebug(1601) << "Year is: " << year << "; Month is: " << columns[8] << "; Day is: " << columns[3] << "; Time is: " << columns[10] << endl; - strcpy(columns[3], timestamp.ascii()); + strncpy(columns[3], timestamp.ascii(), sizeof(columns[3])); + columns[3][sizeof(columns[3])-1] = '\0'; kdDebug(1601) << "The actual file is " << filename << endl; Index: kdeutils/ark/tar.cc diff -u kdeutils/ark/tar.cc:1.52 kdeutils/ark/tar.cc:1.52.2.1 --- kdeutils/ark/tar.cc:1.52 Sat Jun 23 13:50:33 2001 +++ kdeutils/ark/tar.cc Tue Mar 5 09:28:03 2002 @@ -118,6 +118,7 @@ QString::fromLocal8Bit(".tar")); tmpfile = pTempFile->name(); + delete pTempFile; kdDebug(1601) << "Tmpfile will be " << tmpfile << "\n" << endl; } kdDebug(1601) << "-TarArch::TarArch" << endl; Index: kdeutils/ark/zoo.cc diff -u kdeutils/ark/zoo.cc:1.13 kdeutils/ark/zoo.cc:1.13.2.2 --- kdeutils/ark/zoo.cc:1.13 Fri Feb 23 19:46:10 2001 +++ kdeutils/ark/zoo.cc Fri Dec 13 11:48:11 2002 @@ -71,7 +71,7 @@ // Note: I'm reversing the ratio and the length for better display - sscanf(_line, " %[0-9] %[0-9%] %[0-9] %[0-9] %[a-zA-Z] %[0-9]%[ ]%11[ 0-9:+-]%2[C ]%[^\n]", + sscanf(_line, " %79[0-9] %79[0-9%] %79[0-9] %79[0-9] %79[a-zA-Z] %79[0-9]%79[ ]%11[ 0-9:+-]%2[C ]%4095[^\n]", columns[1], columns[0], columns[2], columns[3], columns[7], columns[8], columns[9], columns[4], columns[10], filename); @@ -86,11 +86,12 @@ strDate.sprintf("%s-%.2d-%.2d", year.utf8().data(), Utils::getMonth(columns[7]), atoi(columns[3])); - strcpy(columns[3], strDate.ascii()); + strncpy(columns[3], strDate.ascii(), sizeof(columns[3])); + columns[3][sizeof(columns[3])] = '\0'; kdDebug(1601) << "New timestamp is " << columns[3] << endl; - strcat(columns[3], " "); - strcat(columns[3], fixTime(columns[4]).ascii()); + strncat(columns[3], " ", sizeof(columns[3])-strlen(columns[3])-1); + strncat(columns[3], fixTime(columns[4]).ascii(),sizeof(columns[3])-strlen(columns[3])-1); QStringList list; list.append(QString::fromLocal8Bit(filename)); Index: kdeutils/kdf/disklist.cpp diff -u kdeutils/kdf/disklist.cpp:1.16 kdeutils/kdf/disklist.cpp:1.16.4.3 --- kdeutils/kdf/disklist.cpp:1.16 Tue Dec 26 17:47:54 2000 +++ kdeutils/kdf/disklist.cpp Sun Feb 3 18:02:12 2002 @@ -23,7 +23,10 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include + #include +#include #include #include @@ -238,6 +241,10 @@ int DiskList::readDF() { if (readingDFStdErrOut || dfProc->isRunning()) return -1; + setenv("LANG", "C", 1); + setenv("LANGUAGE", "C", 1); + setenv("LC_TYPE", "C", 1); + setenv("LC_ALL", "C", 1); dfStringErrOut=""; // yet no data received dfProc->clearArguments(); (*dfProc) << DF_COMMAND << DF_ARGS; Index: kdeutils/kfloppy/floppy.cpp diff -u kdeutils/kfloppy/floppy.cpp:1.31 kdeutils/kfloppy/floppy.cpp:1.31.4.1 --- kdeutils/kfloppy/floppy.cpp:1.31 Thu Jan 18 12:50:53 2001 +++ kdeutils/kfloppy/floppy.cpp Mon Feb 4 08:38:24 2002 @@ -621,8 +621,8 @@ pos++; } - printf("ERR: <%s>\n", mybuffer); - printf("pos=%d, len=%d\n", pos, amount); + //printf("ERR: <%s>\n", mybuffer); + //printf("pos=%d, len=%d\n", pos, amount); abort = true; fserrstring += mybuffer+pos; Index: kdeutils/klaptopdaemon/portable.cpp diff -u kdeutils/klaptopdaemon/portable.cpp:1.13 kdeutils/klaptopdaemon/portable.cpp:1.13.2.1 --- kdeutils/klaptopdaemon/portable.cpp:1.13 Wed May 16 04:16:35 2001 +++ kdeutils/klaptopdaemon/portable.cpp Fri Dec 6 16:13:59 2002 @@ -73,7 +73,7 @@ f = fopen("/proc/apm", "r"); if (f == NULL) return(1); - s = fscanf(f, "%s %d.%d %x %x %x %x %d%% %d %s\n", + s = fscanf(f, "%255s %d.%d %x %x %x %x %d%% %d %s\n", version, &tmp, &tmp,