mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fix memory copying errors
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/freeze-1_6_0@15988 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bce4cf0f1b
commit
657164bbfd
2 changed files with 12 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-02-17 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSString.m: (fillHole) fix memory overrun (read only) and
|
||||
argument order errors (in code not normally compiled) spotted by
|
||||
Manuel Guesdon.
|
||||
|
||||
2003-02-16 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Version 1.5.2
|
||||
|
|
|
@ -1053,14 +1053,14 @@ fillHole(ivars self, unsigned index, unsigned size)
|
|||
|
||||
if (self->_flags.wide == 1)
|
||||
{
|
||||
for (i = index; i <= self->_count; i++)
|
||||
for (i = index; i < self->_count; i++)
|
||||
{
|
||||
self->_contents.u[i] = self->_contents.u[i+size];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = index; i <= self->_count; i++)
|
||||
for (i = index; i < self->_count; i++)
|
||||
{
|
||||
self->_contents.c[i] = self->_contents.c[i+size];
|
||||
}
|
||||
|
@ -1069,14 +1069,14 @@ fillHole(ivars self, unsigned index, unsigned size)
|
|||
#else
|
||||
if (self->_flags.wide == 1)
|
||||
{
|
||||
memcpy(self->_contents.u + index + size,
|
||||
self->_contents.u + index,
|
||||
memcpy(self->_contents.u + index,
|
||||
self->_contents.u + index + size,
|
||||
sizeof(unichar)*(self->_count - index));
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(self->_contents.c + index + size,
|
||||
self->_contents.c + index, (self->_count - index));
|
||||
memcpy(self->_contents.c + index,
|
||||
self->_contents.c + index + size, (self->_count - index));
|
||||
}
|
||||
#endif // STABLE_MEMCPY
|
||||
self->_flags.hash = 0;
|
||||
|
|
Loading…
Reference in a new issue