(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/gcp.c) |
| |
| 396 | | | gcp_term_t* gcp_cmd_add_term(gcp_msg_t* m, gcp_trx_t* tr, gcp_cmd_t* c, gcp_term_t* t, gcp_wildcard_t wildcard, gboolean persistent) { |
| 397 | | | gcp_terms_t* ct; |
| 398 | | | gcp_terms_t* ct2; |
| 399 | | | |
| 400 | | | static gcp_term_t all_terms = {"$",(guint8*)"",1,GCP_TERM_TYPE_UNKNOWN,NULL,NULL,NULL}; |
| 401 | | | |
| 402 | | | if ( !c ) return NULL; |
| 403 | | | |
| 404 | | | if ( wildcard == GCP_WILDCARD_CHOOSE) { |
| 405 | | | return &all_terms; |
| 406 | | | } |
| 407 | | | |
| 408 | | | if (persistent) { |
| 409 | | | if ( c->msg->commited ) { |
| 410 | | | if (wildcard == GCP_WILDCARD_ALL) { |
| 411 | | | for (ct = c->ctx->terms.next; ct; ct = ct->next) { |
| 412 | | | |
| 413 | | | if ( ct->term->start == m ) { |
| 414 | | | return ct->term; |
| 415 | | | } |
| 416 | | | } |
| 417 | | | return NULL; |
| 418 | | | } else { |
| 419 | | | for (ct = c->ctx->terms.next; ct; ct = ct->next) { |
| 420 | | | if ( g_str_equal(ct->term->str,t->str) ) { |
| 421 | | | return ct->term; |
| 422 | | | } |
| 423 | | | } |
| 424 | | | return NULL; |
| 425 | | | } |
| 426 | | | } else { |
| 427 | | | |
| 428 | | | for (ct = c->ctx->terms.next; ct; ct = ct->next) { |
| 429 | | | if ( g_str_equal(ct->term->str,t->str) || ct->term->start == m) { |
| 430 | | | break; |
| 431 | | | } |
| 432 | | | } |
| 433 | | | |
| 434 | | | if ( ! ct ) { |
| 435 | | | |
| 436 | | | if (wildcard == GCP_WILDCARD_ALL) { |
| 437 | | | ct = se_alloc(sizeof(gcp_terms_t)); |
| 438 | | | ct->next = NULL; |
| 439 | | | ct->term = se_alloc0(sizeof(gcp_term_t)); |
| 440 | | | |
| 441 | | | ct->term->start = m; |
| 442 | | | ct->term->str = "*"; |
| 443 | | | ct->term->buffer = NULL; |
| 444 | | | ct->term->len = 0; |
| 445 | | | |
| 446 | | | c->terms.last = c->terms.last->next = ct; |
| 447 | | | |
| 448 | | | ct2 = se_alloc0(sizeof(gcp_terms_t)); |
| 449 | | | ct2->term = ct->term; |
| 450 | | | |
| 451 | | | c->ctx->terms.last->next = ct2; |
| 452 | | | c->ctx->terms.last = ct2; |
| 453 | | | |
| 454 | | | return ct->term; |
| 455 | | | } else { |
| 456 | | | for (ct = c->ctx->terms.next; ct; ct = ct->next) { |
| 457 | | | |
| 458 | | | if ( ct->term->buffer == NULL && tr->cmds->cmd->msg == ct->term->start ) { |
| 459 | | | ct->term->str = se_strdup(t->str); |
| 460 | | | ct->term->buffer = se_memdup(t->buffer,t->len); |
| 461 | | | ct->term->len = t->len; |
| 462 | | | |
| 463 | | | ct2 = se_alloc0(sizeof(gcp_terms_t)); |
| 464 | | | ct2->term = ct->term; |
| 465 | | | |
| 466 | | | c->terms.last = c->terms.last->next = ct2; |
| 467 | | | |
| 468 | | | return ct->term; |
| 469 | | | } |
| 470 | | | |
| 471 | | | if ( g_str_equal(ct->term->str,t->str) ) { |
| 472 | | | ct2 = se_alloc0(sizeof(gcp_terms_t)); |
| 473 | | | ct2->term = ct->term; |
| 474 | | | |
| 475 | | | c->terms.last = c->terms.last->next = ct2; |
| 476 | | | |
| 477 | | | return ct->term; |
| 478 | | | } |
| 479 | | | } |
| 480 | | | |
| 481 | | | ct = se_alloc(sizeof(gcp_terms_t)); |
| 482 | | | ct->next = NULL; |
| 483 | | | ct->term = se_alloc0(sizeof(gcp_term_t)); |
| 484 | | | |
| 485 | | | ct->term->start = m; |
| 486 | | | ct->term->str = se_strdup(t->str); |
| 487 | | | ct->term->buffer = se_memdup(t->buffer,t->len); |
| 488 | | | ct->term->len = t->len; |
| 489 | | | |
| 490 | | | ct2 = se_alloc0(sizeof(gcp_terms_t)); |
| 491 | | | ct2->term = ct->term; |
| 492 | | | |
| 493 | | | c->terms.last = c->terms.last->next = ct2; |
| 494 | | | |
| 495 | | | ct2 = se_alloc0(sizeof(gcp_terms_t)); |
| 496 | | | ct2->term = ct->term; |
| 497 | | | |
| 498 | | | c->ctx->terms.last = c->ctx->terms.last->next = ct2; |
| 499 | | | |
| 500 | | | return ct->term; |
| 501 | | | } |
| 502 | | | } else { |
| 503 | | | ct2 = se_alloc0(sizeof(gcp_terms_t)); |
| 504 | | | ct2->term = ct->term; |
| 505 | | | |
| 506 | | | c->terms.last = c->terms.last->next = ct2; |
| 507 | | | return ct->term; |
| 508 | | | } |
| 509 | | | |
| 510 | | | DISSECTOR_ASSERT_NOT_REACHED();
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
131 | #define DISSECTOR_ASSERT_NOT_REACHED() \ |
132 | (REPORT_DISSECTOR_BUG( \ |
133 | ep_strdup_printf("%s:%u: failed assertion \"DISSECTOR_ASSERT_NOT_REACHED\"", \ |
134 | __FILE__, __LINE__))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
106 | #define REPORT_DISSECTOR_BUG(message) \ |
107 | ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \ |
108 | abort() : \ |
109 | THROW_MESSAGE(DissectorError, message)) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
226 | #define THROW_MESSAGE(x, y) \ |
227 | except_throw(XCEPT_GROUP_WIRESHARK, (x), (y)) |
| |
|
Unreachable Call
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 511 | | | return NULL; |
| 512 | | | } |
| 513 | | | } else { |
| 514 | | | ct = ep_new(gcp_terms_t); |
| 515 | | | ct->term = t; |
| 516 | | | ct->next = NULL; |
| 517 | | | c->terms.last = c->terms.last->next = ct; |
| 518 | | | |
| 519 | | | return t; |
| 520 | | | } |
| 521 | | | |
| 522 | | | } |
| |