Text   |  XML   |  ReML   |   Visible Warnings:

Uninitialized Variable  at iseries.c:558

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

iseries_parse_packet

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/iseries.c)expand/collapse
Show more  
 473  iseries_parse_packet (wtap * wth, FILE_T fh,
 474                        union wtap_pseudo_header *pseudo_header, 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], ipheader[41],
 483      tcpheader[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     * Check for packet headers in first 3 lines this should handle page breaks 
 492     * situations and the header lines output at each page throw and ensure we 
 493     * read both the captured and packet lengths.
 494     */
 495    isValid = FALSE;
 496    for (line = 1; line < ISERIES_PKT_LINES_TO_CHECK; line++)
 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        /* Convert UNICODE data to ASCII */
 509        if (wth->capture.iseries->format == ISERIES_FORMAT_UNICODE)
 510          {
 511           iseries_UNICODE_to_ASCII ((guint8 *)data, ISERIES_LINE_LENGTH);
 512          }
 513        /* look for packet header */
 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)
 524          {
 525            /* OK! We found the packet header line */
 526            isValid = TRUE;
 527            /*
 528             * XXX - The Capture length returned by the iSeries trace doesn't seem to include the src/dest MAC 
 529             * addresses or the packet type. So we add them here.
 530             */
 531            cap_len += 14;
 532            break;
 533          }
 534      }
 535   
 536    /*
 537     * If no packet header found we exit at this point and inform the user.
 538     */
 539    if (!isValid)
 540      {
 541        *err = WTAP_ERR_BAD_RECORD;
 542        *err_info = g_strdup ("iseries: packet header isn't valid");
 543        return -1;
 544      }
 545   
 546    /*
 547     * If we have Wiretap Header then populate it here 
 548     *
 549     * XXX - Timer resolution on the iSeries is hardware dependant; the value for csec may be
 550     * different on other platforms though all the traces I've seen seem to show resolution 
 551     * to Milliseconds (i.e HH:MM:SS.nnnnn) or Nanoseconds (i.e HH:MM:SS.nnnnnn)
 552     */
 553    if (wth->capture.iseries->sdate)
 554      {
 555        num_items_scanned =
 556          sscanf (wth->capture.iseries->sdate, "%d/%d/%d", &month, &day, &year);
 557        tm.tm_year = 100 + year;
 558        tm.tm_mon = month - 1;
Show more  




Change Warning 1009.30024 : Uninitialized Variable

Priority:
State:
Finding:
Owner:
Note: