(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/iseries.c) |
| |
| 473 | | | iseries_parse_packet (wtap * wth, FILE_T fh, |
| 474 | | | union *, guint8 * pd, |
| 475 | | | int *err, gchar ** err_info) |
| 476 | | | { |
| 477 | | | gint64 cur_off; |
| 478 | | | gboolean isValid, isCurrentPacket, IPread, TCPread, isDATA; |
| 479 | | | int num_items_scanned, line, pktline, buflen, i; |
| 480 | | | guint32 pkt_len; |
| 481 | | | int cap_len, pktnum, month, day, year, hr, min, sec, csec; |
| 482 | | | char direction[2], destmac[13], srcmac[13], type[5], [41], |
| 483 | | | [81]; |
| 484 | | | char hex1[17], hex2[17], hex3[17], hex4[17]; |
| 485 | | | char data[ISERIES_LINE_LENGTH * 2]; |
| 486 | | | guint8 *buf, *asciibuf; |
| 487 | | | char *tcpdatabuf, *workbuf; |
| 488 | | | struct tm tm; |
| 489 | | | |
| 490 | | | |
| 491 | | | |
| 492 | | | |
| 493 | | | |
| 494 | | | |
| 495 | | | isValid = FALSE; |
| 496 | | | for (line = 1; line < ISERIES_PKT_LINES_TO_CHECK; line++) |
Event 1:
Entering loop body. line < 4 evaluates to true.
hide
|
|
| 497 | | | { |
| 498 | | | cur_off = file_tell (fh); |
| 499 | | | if (file_gets (data, ISERIES_LINE_LENGTH, fh) == NULL) |
| 500 | | | { |
| 501 | | | *err = file_error (fh); |
| 502 | | | if (*err == 0) |
| 503 | | | { |
| 504 | | | *err = WTAP_ERR_SHORT_READ; |
| 505 | | | } |
| 506 | | | return -1; |
| 507 | | | } |
| 508 | | | |
| 509 | | | if (wth->capture.iseries->format == ISERIES_FORMAT_UNICODE) |
Event 4:
Taking true branch. wth->capture.iseries->format == 2 evaluates to true.
hide
|
|
| 510 | | | { |
| 511 | | | iseries_UNICODE_to_ASCII ((guint8 *)data, ISERIES_LINE_LENGTH); |
| 512 | | | } |
| 513 | | | |
| 514 | | | for (i=0; i<8; i++) { |
| 515 | | | if (strncmp(data+i,"*",1) == 0) |
| 516 | | | g_strlcpy(data+i," ",(ISERIES_LINE_LENGTH * 2)); |
| 517 | | | } |
| 518 | | | num_items_scanned = |
| 519 | | | sscanf (data, |
| 520 | | | "%6d %1s %6d %d:%d:%d.%d %12s %12s ETHV2 Type: %4s", |
| 521 | | | &pktnum, direction, &cap_len, &hr, &min, &sec, &csec, destmac, |
| 522 | | | srcmac, type); |
| 523 | | | if (num_items_scanned == 10) |
Event 7:
Taking true branch. num_items_scanned == 10 evaluates to true.
hide
|
|
| 524 | | | { |
| 525 | | | |
| 526 | | | isValid = TRUE; |
Event 8:
!0 evaluates to true.
hide
|
|
| 527 | | | |
| 528 | | | |
| 529 | | | |
| 530 | | | |
| 531 | | | cap_len += 14; |
| 532 | | | break; |
| 533 | | | } |
| 534 | | | } |
| 535 | | | |
| 536 | | | |
| 537 | | | |
| 538 | | | |
| 539 | | | if (!isValid) |
Event 9:
Skipping " if". isValid evaluates to true.
hide
|
|
| 540 | | | { |
| 541 | | | *err = WTAP_ERR_BAD_RECORD; |
| 542 | | | *err_info = g_strdup ("iseries: packet isn't valid"); |
| 543 | | | return -1; |
| 544 | | | } |
| 545 | | | |
| 546 | | | |
| 547 | | | |
| 548 | | | |
| 549 | | | |
| 550 | | | |
| 551 | | | |
| 552 | | | |
| 553 | | | if (wth->capture.iseries->sdate) |
Event 10:
Taking true branch. wth->capture.iseries->sdate evaluates to true.
hide
|
|
| 554 | | | { |
| 555 | | | num_items_scanned = |
| 556 | | | sscanf (wth->capture.iseries->sdate, "%d/%d/%d", &month, &day, &year); |
Event 11:
__isoc99_sscanf() does not initialize year. - This may be because of a failure case or other special case for __isoc99_sscanf(). Consult the __isoc99_sscanf() documentation for more information.
hide
|
|
| 557 | | | tm.tm_year = 100 + year; |
Uninitialized Variable
year was not initialized. The issue can occur if the highlighted code executes. See related event 11. Show: All events | Only primary events |
|
| |