Added range check

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4359 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-06-04 15:15:59 +00:00
parent dafd02285a
commit a59b83787f

View file

@ -662,7 +662,14 @@ handle_printf_atsign (FILE *stream,
- (void) getCharacters: (unichar*)buffer
range: (NSRange)aRange
{
int i;
unsigned l = [self length];
unsigned i;
if (aRange.location >= l)
[NSException raise: NSRangeException format:@"Invalid location."];
if (aRange.length > (l - aRange.location))
[NSException raise:NSRangeException format:@"Invalid location+length"];
for (i = 0; i < aRange.length; i++)
{
buffer[i] = [self characterAtIndex: aRange.location+i];