Previously read_cert_file() only checked for EOF as returned by getc
when reading a cert file. This patch checks for ferror and feof before
continuing to loop over file contents.

Found with clang analyze.

Fixes: 9467fe624698 ("Add SSL support to "stream" library and OVSDB.")
Signed-off-by: Mike Pattrick <[email protected]>
---
 lib/stream-ssl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c
index 9b468e0fa..d4dce4dd9 100644
--- a/lib/stream-ssl.c
+++ b/lib/stream-ssl.c
@@ -1422,7 +1422,7 @@ read_cert_file(const char *file_name, X509 ***certs, 
size_t *n_certs)
         /* Are there additional certificates in the file? */
         do {
             c = getc(file);
-        } while (isspace(c));
+        } while (c != EOF && isspace(c));
         if (c == EOF) {
             break;
         }
-- 
2.54.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to