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

« back to all changes in this revision

Viewing changes to filters/kword/kword1.3/import/kword13formatone.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:
 
1
#include <qtextstream.h>
 
2
 
 
3
#include "kword13utils.h"
 
4
#include "kword13formatone.h"
 
5
 
 
6
KWord13FormatOneData::KWord13FormatOneData( void )
 
7
{
 
8
}
 
9
 
 
10
KWord13FormatOneData::~KWord13FormatOneData( void )
 
11
{
 
12
}
 
13
 
 
14
void KWord13FormatOneData::xmldump( QTextStream& iostream )
 
15
{
 
16
    iostream << "     <formatone>"  << "\">\n";
 
17
    
 
18
    for ( QMap<QString,QString>::ConstIterator it = m_properties.begin();
 
19
        it != m_properties.end();
 
20
        ++it)
 
21
    {
 
22
        iostream << "       <param key=\"" << it.key() << "\" data=\"" << EscapeXmlDump( it.data() ) << "\"/>\n";
 
23
    }
 
24
    
 
25
    iostream << "    </formatone>\n";
 
26
}
 
27
 
 
28
QString KWord13FormatOneData::key( void ) const
 
29
{
 
30
    QString strKey;
 
31
    
 
32
    // At first, use the number of properties as it is an easy sorting value
 
33
    strKey += QString::number( m_properties.count(), 16 );
 
34
    strKey += ':';
 
35
  
 
36
    // use the worst key: the whole QMap (### FIXME)
 
37
    for ( QMap<QString,QString>::const_iterator it = m_properties.constBegin() ;
 
38
        it != m_properties.constEnd(); ++it )
 
39
    {
 
40
        strKey += it.key();
 
41
        strKey += '=';
 
42
        strKey += it.data();
 
43
        strKey += ';';
 
44
    }
 
45
      
 
46
    return strKey;
 
47
}
 
48
 
 
49
QString KWord13FormatOneData::getProperty( const QString& name ) const
 
50
{
 
51
    QMap<QString,QString>::ConstIterator it ( m_properties.find( name ) );
 
52
    if ( it == m_properties.end() )
 
53
    {
 
54
        // Property does not exist
 
55
        return QString::null;
 
56
    }
 
57
    else
 
58
    {
 
59
        return it.data();
 
60
    }
 
61
}
 
62
 
 
63
//
 
64
//
 
65
//
 
66
 
 
67
KWord13FormatOne::KWord13FormatOne(void) : m_length(1)
 
68
{
 
69
    m_id = 1;
 
70
}
 
71
 
 
72
KWord13FormatOne::~KWord13FormatOne(void)
 
73
{
 
74
}
 
75
 
 
76
int KWord13FormatOne::length(void)
 
77
{
 
78
    return m_length;
 
79
}
 
80
 
 
81
KWord13FormatOneData* KWord13FormatOne::getFormatOneData(void)
 
82
{
 
83
    return &m_formatOne;
 
84
}
 
85