mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-18 04:55:56 +00:00
avoid comparisons that extend past the string length
(cherry picked from commit 21ee23e7df)
This commit is contained in:
committed by
Francis Lachapelle
parent
a204616831
commit
19fceff5cb
@@ -134,15 +134,16 @@ static int cssEscapingCount;
|
||||
start--;
|
||||
start++;
|
||||
|
||||
length = [self length];
|
||||
// In [UIxMailPartTextViewer flatContentAsString], we first escape HTML entities and then
|
||||
// add URLs. Therefore, the brackets (inequality signs <>) have been encoded at this point.
|
||||
if ([[self substringWithRange: NSMakeRange (start, 4)] compare: @"<"] == NSOrderedSame)
|
||||
if (length > (start + 4)
|
||||
&& [[self substringWithRange: NSMakeRange (start, 4)] compare: @"<"] == NSOrderedSame)
|
||||
start += 4;
|
||||
|
||||
length = [self length] - start;
|
||||
workRange = NSMakeRange (start, length);
|
||||
length -= start;
|
||||
workRange = [self rangeOfCharacterFromSet: urlAfterEndingChars
|
||||
options: NSLiteralSearch range: workRange];
|
||||
options: NSLiteralSearch range: NSMakeRange (start, length)];
|
||||
if (workRange.location != NSNotFound)
|
||||
length = workRange.location - start;
|
||||
while
|
||||
|
||||
Reference in New Issue
Block a user