(/home/sate/Testcases/c/cve/wireshark-1.2.0/filters.c) |
| |
| 463 | | | save_filter_list(filter_list_type_t list_type, char **pref_path_return, |
| 464 | | | int *errno_return) |
| 465 | | | { |
| 466 | | | const gchar *ff_name; |
| 467 | | | gchar *ff_path, *ff_path_new; |
| 468 | | | GList *fl; |
| 469 | | | GList *flpp; |
| 470 | | | filter_def *filt; |
| 471 | | | FILE *ff; |
| 472 | | | guchar *p, c; |
| 473 | | | |
| 474 | | | *pref_path_return = NULL; |
| 475 | | | |
| 476 | | | switch (list_type) { |
| 477 | | | |
| 478 | | | case CFILTER_LIST: |
| 479 | | | ff_name = CFILTER_FILE_NAME; |
| 480 | | | fl = capture_filters; |
| 481 | | | break; |
| 482 | | | |
| 483 | | | case DFILTER_LIST: |
| 484 | | | ff_name = DFILTER_FILE_NAME; |
| 485 | | | fl = display_filters; |
| 486 | | | break; |
| 487 | | | |
| 488 | | | default: |
| 489 | | | g_assert_not_reached();
x /usr/include/glib-2.0/glib/gtestutils.h |
| |
73 | #define g_assert_not_reached() do { g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } while (0) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
160 | # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) |
| |
|
| 490 | | | return; |
Unreachable Control Flow
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 491 | | | } |
| 492 | | | |
| 493 | | | ff_path = get_persconffile_path(ff_name, TRUE, TRUE); |
| 494 | | | |
| 495 | | | |
| 496 | | | |
| 497 | | | |
| 498 | | | ff_path_new = g_strdup_printf("%s.new", ff_path); |
| 499 | | | |
| 500 | | | if ((ff = ws_fopen(ff_path_new, "w")) == NULL) { |
| 501 | | | *pref_path_return = ff_path; |
| 502 | | | *errno_return = errno; |
| 503 | | | g_free(ff_path_new); |
| 504 | | | return; |
| 505 | | | } |
| 506 | | | flpp = g_list_first(fl); |
| 507 | | | while (flpp) { |
| 508 | | | filt = (filter_def *) flpp->data; |
| 509 | | | |
| 510 | | | |
| 511 | | | |
| 512 | | | putc('"', ff); |
| 513 | | | for (p = (guchar *)filt->name; (c = *p) != '\0'; p++) { |
| 514 | | | if (c == '"' || c == '\\') |
| 515 | | | putc('\\', ff); |
| 516 | | | putc(c, ff); |
| 517 | | | } |
| 518 | | | putc('"', ff); |
| 519 | | | |
| 520 | | | |
| 521 | | | putc(' ', ff); |
| 522 | | | |
| 523 | | | |
| 524 | | | fprintf(ff, "%s\n", filt->strval); |
| 525 | | | if (ferror(ff)) { |
| 526 | | | *pref_path_return = ff_path; |
| 527 | | | *errno_return = errno; |
| 528 | | | fclose(ff); |
| 529 | | | ws_unlink(ff_path_new); |
| 530 | | | g_free(ff_path_new); |
| 531 | | | return; |
| 532 | | | } |
| 533 | | | flpp = flpp->next; |
| 534 | | | } |
| 535 | | | if (fclose(ff) == EOF) { |
| 536 | | | *pref_path_return = ff_path; |
| 537 | | | *errno_return = errno; |
| 538 | | | ws_unlink(ff_path_new); |
| 539 | | | g_free(ff_path_new); |
| 540 | | | return; |
| 541 | | | } |
| 542 | | | |
| 543 | | | #ifdef _WIN32 |
| 544 | | | |
| 545 | | | |
| 546 | | | |
| 547 | | | |
| 548 | | | if (ws_remove(ff_path) < 0 && errno != ENOENT) { |
| 549 | | | |
| 550 | | | |
| 551 | | | |
| 552 | | | *pref_path_return = ff_path; |
| 553 | | | *errno_return = errno; |
| 554 | | | ws_unlink(ff_path_new); |
| 555 | | | g_free(ff_path_new); |
| 556 | | | return; |
| 557 | | | } |
| 558 | | | #endif |
| 559 | | | |
| 560 | | | if (ws_rename(ff_path_new, ff_path) < 0) { |
| 561 | | | *pref_path_return = ff_path; |
| 562 | | | *errno_return = errno; |
| 563 | | | ws_unlink(ff_path_new); |
| 564 | | | g_free(ff_path_new); |
| 565 | | | return; |
| 566 | | | } |
| 567 | | | g_free(ff_path_new); |
| 568 | | | g_free(ff_path); |
| 569 | | | } |
| |