Fixed read loop not breaking out for invalid signatures

Reported by Mark Wallace

Signed-off-by: Ozan Turgut <ozanturgut@gmail.com>