read() wasn't being checked for errors.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3063
e7ae566f-a301-0410-adde-
c780ea21d3b5
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;