summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-09-29 16:27:58 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-09-29 20:26:06 +0200
commite880a88834e2a34163ece6eb4ca62d8244d6155c (patch)
treeb7ca24500b7a39f67dc776de6ce8b02df04ee48e /svx
parent383622a30da5cd5128e0b775eb4f75f40a1d4426 (diff)
fix undefined behavior with out-of-bounds substring access
Change-Id: Ie40d3dd2947d41b62eae84f20cfe457d69cc4bfe
Diffstat (limited to 'svx')
-rw-r--r--svx/source/xoutdev/xattr.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index a2ac5d255803..101431745f8e 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -220,9 +220,13 @@ OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_u
}
else
{
- sal_Int32 nThisIndex = pEntry->GetName().copy( aUser.getLength() ).toInt32();
- if( nThisIndex >= nUserIndex )
- nUserIndex = nThisIndex + 1;
+ OUString aEntryName = pEntry->GetName();
+ if(aEntryName.getLength() >= aUser.getLength())
+ {
+ sal_Int32 nThisIndex = aEntryName.copy( aUser.getLength() ).toInt32();
+ if( nThisIndex >= nUserIndex )
+ nUserIndex = nThisIndex + 1;
+ }
}
}
}