mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
([NSString -substringFromRange:]): Fix bug in references to string
length. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1677 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
370a3ac19f
commit
fd3b4b308e
1 changed files with 3 additions and 2 deletions
|
@ -484,10 +484,11 @@ handle_printf_atsign (FILE *stream,
|
|||
- (NSString*) substringFromRange: (NSRange)aRange
|
||||
{
|
||||
unichar buffer[aRange.length];
|
||||
int count = [self length];
|
||||
|
||||
if (aRange.location > _count)
|
||||
if (aRange.location > count)
|
||||
[NSException raise: NSRangeException format: @"Invalid location."];
|
||||
if (aRange.length > (_count - aRange.location))
|
||||
if (aRange.length > (count - aRange.location))
|
||||
[NSException raise: NSRangeException format: @"Invalid location+length."];
|
||||
[self getCharacters: buffer range: aRange];
|
||||
return [[self class] stringWithCharacters: buffer length: aRange.length];
|
||||
|
|
Loading…
Reference in a new issue