~ubuntu-branches/ubuntu/breezy/koffice/breezy-security

« back to all changes in this revision

Viewing changes to filters/kword/palmdoc/palmdb.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-10-11 14:49:50 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051011144950-lwpngbifzp8nk0ds
Tags: 1:1.4.1-0ubuntu7
* SECURITY UPDATE: fix heap based buffer overflow in the RTF importer of KWord
* Opening specially crafted RTF files in KWord can cause
  execution of abitrary code.
* Add kubuntu_01_rtfimport_heap_overflow.diff
* References:
  CAN-2005-2971
  CESA-2005-005
  http://www.koffice.org/security/advisory-20051011-1.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
   Boston, MA 02111-1307, USA.
18
18
*/
19
19
 
 
20
/*
 
21
   The database layout for PalmDB files is described in 
 
22
   http://www.palmos.com/dev/support/docs/protein_books/FileFormats/Intro.html
 
23
*/
 
24
 
20
25
#include "palmdb.h"
21
26
 
22
27
#include <qcstring.h>
67
72
  // now start to read PDB header (72 bytes)
68
73
 
69
74
  // read and encode database name
 
75
  // The name field is 32 bytes long, and is NUL terminated.
 
76
  // Use the length parameter of fromLatin1() anyway.
70
77
  Q_UINT8 name[32];
71
78
  for(int k = 0; k < 32; k++)
72
79
    stream >> name[k];
208
215
  // write database name
209
216
  setName( name() );
210
217
  const char *dbname = m_name.latin1();
211
 
  for( unsigned k=0; k<32; k++ )
 
218
  for( unsigned k=0; k<31; k++ )
212
219
  {
213
220
    Q_UINT8 c = (k<m_name.length()) ? dbname[k] : 0;
214
221
    stream << c;
215
222
  }
 
223
  {
 
224
    // NUL-terminate the database name
 
225
    Q_UINT8 c = 0;
 
226
    stream << c;
 
227
  }
 
228
 
 
229
 
216
230
 
217
231
  // write database attribute
218
232
  Q_UINT16 attr = m_attributes;