mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
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:
parent
dafd02285a
commit
a59b83787f
1 changed files with 8 additions and 1 deletions
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue