Skip to content

Commit

Permalink
Fix memory issue in parser for long string
Browse files Browse the repository at this point in the history
Do a check on the cursor before trying to get length, because
we could already be at the end.

[#5]
  • Loading branch information
camelpunch committed Mar 28, 2016
1 parent 5a07e90 commit 9d64a8e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions RMQClient/AMQParser.m
Expand Up @@ -107,6 +107,9 @@ - (NSString *)parseShortString {
}

- (NSString *)parseLongString {
if (self.cursor >= self.end) {
return @"";
}
UInt32 length = CFSwapInt32BigToHost(*(UInt32 *)self.cursor);
const char *expectedStringEnd = self.cursor + sizeof(length) + length;

Expand Down

0 comments on commit 9d64a8e

Please sign in to comment.