aboutsummaryrefslogtreecommitdiff
path: root/crypto.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crypto.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto.c b/crypto.c
index ebb7981..9868528 100644
--- a/crypto.c
+++ b/crypto.c
@@ -1052,13 +1052,15 @@ read_key_file (struct key2 *key2, const char *file, const unsigned int flags)
if (fd == -1)
msg (M_ERR, "Cannot open file key file '%s'", file);
size = read (fd, in.data, in.capacity);
+ if (size < 0)
+ msg (M_FATAL, "Read error on key file ('%s')", file);
if (size == in.capacity)
msg (M_FATAL, "Key file ('%s') can be a maximum of %d bytes", file, (int)in.capacity);
close (fd);
}
cp = (unsigned char *)in.data;
- while (size)
+ while (size > 0)
{
const unsigned char c = *cp;