diff options
author | Guy Harris <guy@alum.mit.edu> | 2007-05-02 19:46:05 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2007-05-02 19:46:05 +0000 |
commit | cbea9dd75bb336f890d7f2aa24e0421248e371de (patch) | |
tree | 04e74771b096a90d1649dd856f7eefda3af16013 /epan/dissectors/packet-ssl.c | |
parent | 2cbb8e33e241afd8da168e8fc2256a4e249f99a5 (diff) |
Check for read failures, and report them (and don't parse the key list
if we get one).
svn path=/trunk/; revision=21650
Diffstat (limited to 'epan/dissectors/packet-ssl.c')
-rw-r--r-- | epan/dissectors/packet-ssl.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c index 10b7e2f3db..a3024911ad 100644 --- a/epan/dissectors/packet-ssl.c +++ b/epan/dissectors/packet-ssl.c @@ -306,6 +306,7 @@ ssl_parse(void) size_t size; gchar *tmp_buf; size_t nbytes; + gboolean read_failed; ssl_set_debug(ssl_debug_file_name); @@ -329,13 +330,19 @@ ssl_parse(void) { if (file_exists(ssl_keys_list)) { if ((ssl_keys_file = fopen(ssl_keys_list, "r"))) { + read_failed = FALSE; fstat(fileno(ssl_keys_file), &statb); size = statb.st_size; tmp_buf = ep_alloc0(size + 1); nbytes = fread(tmp_buf, 1, size, ssl_keys_file); + if (ferror(ssl_keys_file)) { + report_read_failure(ssl_keys_list, errno); + read_failed = TRUE; + } fclose(ssl_keys_file); tmp_buf[nbytes] = '\0'; - ssl_parse_key_list(tmp_buf,ssl_key_hash,ssl_associations,ssl_handle,TRUE); + if (!read_failed) + ssl_parse_key_list(tmp_buf,ssl_key_hash,ssl_associations,ssl_handle,TRUE); } else { report_open_failure(ssl_keys_list, errno, FALSE); } |