From 4ab227c89a483dc2ff51a1a57f88239e20e64fa4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 14 Nov 2014 10:04:35 +0100 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/common.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/common.c b/src/common.c index e9bdaf2..051e32f 100644 --- a/src/common.c +++ b/src/common.c @@ -335,7 +335,7 @@ static int check_checksums(const char* restrict filename, const libkeccak_spec_t } size = ptr; close(fd), fd = -1; - + if (ptr == size) { if (new = realloc(buf, size += 1), new == NULL) @@ -354,15 +354,19 @@ static int check_checksums(const char* restrict filename, const libkeccak_spec_t else if (('A' <= c) && (c <= 'F')); else if ((c == ' ') || (c == '\t')) hash_end = ptr, stage++; + else if ((c == '\n') || (c == '\f') || (c == '\r')) + hash_end = ptr, stage = 3; else { - rc = USER_ERROR("file is malformated"); + rc = USER_ERROR("file is malformated"); /* FIXME error at end of file! c is zero! why!? */ goto fail; } } else if (stage == 1) { - if ((c != ' ') && (c != '\t')) + if ((c == '\n') || (c == '\f') || (c == '\r')) + stage = 3; + else if ((c != ' ') && (c != '\t')) file_start = ptr, stage++; } else if (stage == 2) -- cgit v1.2.3-70-g09d2