diff options
author | Hadriel Kaplan <hadrielk@yahoo.com> | 2014-02-25 11:25:47 -0500 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-02-27 17:57:02 +0000 |
commit | c875dc8597a6ff3a513cd6b8397626c331564f5e (patch) | |
tree | db8d463a58d281291b6825e56fe6495dce55d199 /dumpcap.c | |
parent | 1828c34519ac16255cbd003cdceded51ef8b789f (diff) |
Fix dumpcap.c: Assigned value is garbage or undefined (clang analyzer)
Change-Id: I61dbf5e1e206b1c0d2e594bfba38e83e51e8f09c
Reviewed-on: https://code.wireshark.org/review/371
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1968,7 +1968,7 @@ cap_pipe_open_live(char *pipename, wchar_t *err_str; #endif ssize_t b; - int fd, sel_ret; + int fd = -1, sel_ret; size_t bytes_read; guint32 magic = 0; @@ -2146,6 +2146,11 @@ cap_pipe_open_live(char *pipename, /* read the pcap header */ bytes_read = 0; while (bytes_read < sizeof magic) { + if (fd == -1) { + g_snprintf(errmsg, errmsgl, "Invalid file descriptor"); + goto error; + } + sel_ret = cap_pipe_select(fd); if (sel_ret < 0) { g_snprintf(errmsg, errmsgl, |