(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/file_access.c) |
| |
| 886 | | | static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int filetype, gboolean compressed, int *err) |
| 887 | | | { |
| 888 | | | int fd; |
| 889 | | | gboolean cant_seek; |
| 890 | | | |
| 891 | | | |
| 892 | | | |
| 893 | | | if(compressed) { |
Event 1:
Taking false branch. compressed evaluates to false.
hide
|
|
| 894 | | | cant_seek = TRUE; |
| 895 | | | } else { |
| 896 | | | fd = fileno(wdh->fh); |
Event 2:
fileno() returns -1. - Determines the file descriptor in the Negative File Descriptor warning later.
hide
Event 3:
fd is set to fileno(wdh->fh), which evaluates to -1. See related event 2.
hide
|
|
| 897 | | | if (lseek(fd, 1, SEEK_CUR) == -1)
x /usr/include/fcntl.h |
| |
101 | # define SEEK_CUR 1 /* Seek from current position. */ |
| |
|
Event 4:
Taking false branch. lseek(fd, 1, 1) == -1 evaluates to false.
hide
|
|
| 898 | | | cant_seek = TRUE; |
| 899 | | | else { |
| 900 | | | |
| 901 | | | lseek(fd, 0, SEEK_SET);
x /usr/include/fcntl.h |
| |
100 | # define SEEK_SET 0 /* Seek from beginning of file. */ |
| |
|
Event 5:
fd, which evaluates to -1, is passed to lseek() as the first argument. See related event 3.
hide
Negative file descriptor
File descriptor argument fd has value -1. - lseek() will fail when called with a negative file descriptor.
The issue can occur if the highlighted code executes. See related event 5. Show: All events | Only primary events |
|
| |