[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE_2_2_BRANCH: kdeutils/ark
From:       Waldo Bastian <bastian () kde ! org>
Date:       2002-12-13 10:48:12
[Download RAW message or body]

CVS commit by waba: 

strcpy fixes


  M +2 -2      arch.cpp   1.35.2.1
  M +3 -2      lha.cc   1.25.2.2
  M +3 -2      rar.cc   1.17.2.2
  M +5 -4      zoo.cc   1.13.2.2


--- kdeutils/ark/arch.cpp  #1.35:1.35.2.1
@@ -489,5 +489,5 @@ QString Utils::fixYear(const char *strYe
       strcpy(fourDigits, "20");
     }
-  strcat(fourDigits, strYear);
+  strncat(fourDigits, strYear, sizeof(fourDigits)-strlen(fourDigits)-1);
   return fourDigits;
 }

--- kdeutils/ark/lha.cc  #1.25.2.1:1.25.2.2
@@ -103,5 +103,6 @@ bool LhaArch::processLine(const QCString
   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;

--- kdeutils/ark/rar.cc  #1.17.2.1:1.17.2.2
@@ -108,5 +108,6 @@ bool RarArch::processLine(const QCString
   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;

--- kdeutils/ark/zoo.cc  #1.13.2.1:1.13.2.2
@@ -87,9 +87,10 @@ bool ZooArch::processLine(const QCString
                     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;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic