Fix appending nul string

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6414 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-04-04 18:36:46 +00:00
parent 198a414d6b
commit cc2156d4b9

View file

@ -1983,23 +1983,26 @@ handle_printf_atsign (FILE *stream,
{ {
length--; length--;
} }
aLength = length - 1; if (length > 0)
while (aLength > 1)
{ {
if (pathSepMember(buf[aLength]) == YES) aLength = length - 1;
while (aLength > 1)
{ {
if (pathSepMember(buf[aLength-1]) == YES) if (pathSepMember(buf[aLength]) == YES)
{ {
unsigned pos; if (pathSepMember(buf[aLength-1]) == YES)
for (pos = aLength+1; pos < length; pos++)
{ {
buf[pos-1] = buf[pos]; unsigned pos;
for (pos = aLength+1; pos < length; pos++)
{
buf[pos-1] = buf[pos];
}
length--;
} }
length--;
} }
aLength--;
} }
aLength--;
} }
return [NSString stringWithCharacters: buf length: length]; return [NSString stringWithCharacters: buf length: length];
} }