diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-07-17 04:25:50 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-07-17 04:25:50 +0000 |
commit | 24f8f368ebee5b7724f4b046a1f28066ffd9223f (patch) | |
tree | 0bc46d906dbc72d817c38144debc1addb7444ff6 | |
parent | Added SOCKET_SND_RCV_BUF_MAX constant (set to 1000000) to limit the (diff) | |
download | openvpn-24f8f368ebee5b7724f4b046a1f28066ffd9223f.tar.xz |
Fixed issue in read_key_file, where the return value of
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
-rw-r--r-- | crypto.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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; |