diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2013-04-10 17:11:51 +0000 |
---|---|---|
committer | Martin Kaiser <wireshark@kaiser.cx> | 2013-04-10 17:11:51 +0000 |
commit | dbec63309a00ea1cea3fd7e4417a52dc3c3e172d (patch) | |
tree | 7739984ec44a2010249e75c9c8e1f061e3189982 /plugins | |
parent | 0a396007fe9c5385573b4464d053613fcb4f29bb (diff) |
Coverity CID 280337 Unchecked return value
check the return value of fstat()
svn path=/trunk/; revision=48809
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/asn1/packet-asn1.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/asn1/packet-asn1.c b/plugins/asn1/packet-asn1.c index 7eae06e51d..cbff11702f 100644 --- a/plugins/asn1/packet-asn1.c +++ b/plugins/asn1/packet-asn1.c @@ -3133,7 +3133,8 @@ static void read_asn1_type_table(const char *filename) { FILE *f; - guint size; + int ret; + guint size = 0; guchar *data; struct stat file_stat; static guint mylogh = 0; @@ -3157,10 +3158,11 @@ read_asn1_type_table(const char *filename) report_open_failure(filename, errno, FALSE); return; } - fstat(fileno(f), &file_stat); - size = (int)file_stat.st_size; + ret = fstat(fileno(f), &file_stat); + if (ret!=-1) + size = (int)file_stat.st_size; if (size == 0) { - if (asn1_verbose) g_message("file %s is empty, ignored", filename); + if (asn1_verbose) g_message("file %s is empty or size is unknown, ignored", filename); fclose(f); return; } |