(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/iax2_analysis.c) |
| |
| 2227 | | | static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *user_data) |
| 2228 | | | { |
| 2229 | | | int to_fd, forw_fd, rev_fd, fread = 0, rread = 0, fwritten, rwritten; |
| 2230 | | | gchar f_pd[1] = {0}; |
| 2231 | | | gchar r_pd[1] = {0}; |
| 2232 | | | gint16 sample; |
| 2233 | | | gchar pd[4]; |
| 2234 | | | guint32 f_write_silence = 0; |
| 2235 | | | guint32 r_write_silence = 0; |
| 2236 | | | progdlg_t *progbar; |
| 2237 | | | guint32 progbar_count, progbar_quantum, progbar_nextstep = 0, count = 0; |
| 2238 | | | gboolean stop_flag = FALSE; |
| 2239 | | | size_t nchars; |
| 2240 | | | |
| 2241 | | | forw_fd = ws_open(user_data->f_tempname, O_RDONLY | O_BINARY, 0000 );
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wsutil/file_util.h |
| |
105 | #define O_BINARY 0 /* Win32 needs the O_BINARY flag for open() */ |
| |
|
| 2242 | | | if (forw_fd < 0) |
Event 1:
Skipping " if". forw_fd < 0 evaluates to false.
hide
|
|
| 2243 | | | return FALSE; |
| 2244 | | | rev_fd = ws_open(user_data->r_tempname, O_RDONLY | O_BINARY, 0000 );
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wsutil/file_util.h |
| |
105 | #define O_BINARY 0 /* Win32 needs the O_BINARY flag for open() */ |
| |
|
| 2245 | | | if (rev_fd < 0) { |
Event 2:
Skipping " if". rev_fd < 0 evaluates to false.
hide
|
|
| 2246 | | | ws_close(forw_fd); |
| 2247 | | | return FALSE; |
| 2248 | | | } |
| 2249 | | | |
| 2250 | | | |
| 2251 | | | to_fd = ws_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
x /usr/include/bits/fcntl.h |
| |
38 | #define O_CREAT 0100 /* not fcntl */ |
| |
x /usr/include/bits/fcntl.h |
| |
41 | #define O_TRUNC 01000 /* not fcntl */ |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wsutil/file_util.h |
| |
105 | #define O_BINARY 0 /* Win32 needs the O_BINARY flag for open() */ |
| |
|
| 2252 | | | if (to_fd < 0) { |
Event 3:
Skipping " if". to_fd < 0 evaluates to false.
hide
|
|
| 2253 | | | ws_close(forw_fd); |
| 2254 | | | ws_close(rev_fd); |
| 2255 | | | return FALSE; |
| 2256 | | | } |
| 2257 | | | |
| 2258 | | | progbar = create_progress_dlg("Saving voice in a file", dest, TRUE, &stop_flag); |
Event 4:
!0 evaluates to true.
hide
|
|
| 2259 | | | |
| 2260 | | | if (format == SAVE_AU_FORMAT) |
Event 5:
Taking true branch. format == 2 evaluates to true.
hide
|
|
| 2261 | | | { |
| 2262 | | | |
| 2263 | | | |
| 2264 | | | phtonl(pd, 0x2e736e64);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/pint.h |
| |
90 | #define phtonl(p, v) \ |
91 | { \ |
92 | ((guint8*)(p))[0] = (guint8)((v) >> 24); \ |
93 | ((guint8*)(p))[1] = (guint8)((v) >> 16); \ |
94 | ((guint8*)(p))[2] = (guint8)((v) >> 8); \ |
95 | ((guint8*)(p))[3] = (guint8)((v) >> 0); \ |
96 | } |
| |
|
| 2265 | | | nchars=ws_write(to_fd, pd, 4); |
| 2266 | | | |
| 2267 | | | phtonl(pd, 24);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/pint.h |
| |
90 | #define phtonl(p, v) \ |
91 | { \ |
92 | ((guint8*)(p))[0] = (guint8)((v) >> 24); \ |
93 | ((guint8*)(p))[1] = (guint8)((v) >> 16); \ |
94 | ((guint8*)(p))[2] = (guint8)((v) >> 8); \ |
95 | ((guint8*)(p))[3] = (guint8)((v) >> 0); \ |
96 | } |
| |
|
| 2268 | | | nchars=ws_write(to_fd, pd, 4); |
| 2269 | | | |
| 2270 | | | phtonl(pd, -1);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/pint.h |
| |
90 | #define phtonl(p, v) \ |
91 | { \ |
92 | ((guint8*)(p))[0] = (guint8)((v) >> 24); \ |
93 | ((guint8*)(p))[1] = (guint8)((v) >> 16); \ |
94 | ((guint8*)(p))[2] = (guint8)((v) >> 8); \ |
95 | ((guint8*)(p))[3] = (guint8)((v) >> 0); \ |
96 | } |
| |
|
Cast Alters Value
-1 is cast from int to unsigned char. - Negative values cannot be stored as unsigned char. Casting them to unsigned char can cause data loss or sign change.
The issue can occur if the highlighted code executes. Show: All events | Only primary events |
|
| |