Text   |  XML   |  ReML   |   Visible Warnings:

Unreachable Call  at toshiba.c:349

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

parse_toshiba_rec_hdr

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/toshiba.c)expand/collapse
Show more  
 294  parse_toshiba_rec_hdr(wtap *wth, FILE_T fh,
 295      union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info)
 296  {
 297          char    line[TOSHIBA_LINE_LENGTH];
 298          int     num_items_scanned;
 299          int     pkt_len, pktnum, hr, min, sec, csec;
 300          char    channel[10], direction[10];
 301   
 302          /* Our file pointer should be on the line containing the
 303           * summary information for a packet. Read in that line and 
 304           * extract the useful information
 305           */
 306          if (file_gets(line, TOSHIBA_LINE_LENGTH, fh) == NULL) {
 307                  *err = file_error(fh);
 308                  if (*err == 0) {
 309                          *err = WTAP_ERR_SHORT_READ;
 310                  }
 311                  return -1;
 312          }
 313   
 314          /* Find text in line after "[No.". Limit the length of the 
 315           * two strings since we have fixed buffers for channel[] and 
 316           * direction[] */
 317          num_items_scanned = sscanf(line, "%d] %d:%d:%d.%d %9s %9s",
 318                          &pktnum, &hr, &min, &sec, &csec, channel, direction);
 319   
 320          if (num_items_scanned != 7) {
 321                  *err = WTAP_ERR_BAD_RECORD;
 322                  *err_info = g_strdup("toshiba: record header isn't valid");
 323                  return -1;
 324          }
 325   
 326          /* Scan lines until we find the OFFSET line. In a "telnet" trace,
 327           * this will be the next line. But if you save your telnet session 
 328           * to a file from within a Windows-based telnet client, it may
 329           * put in line breaks at 80 columns (or however big your "telnet" box 
 330           * is). CRT (a Windows telnet app from VanDyke) does this.
 331           * Here we assume that 80 columns will be the minimum size, and that
 332           * the OFFSET line is not broken in the middle. It's the previous
 333           * line that is normally long and can thus be broken at column 80.
 334           */
 335          do {
 336                  if (file_gets(line, TOSHIBA_LINE_LENGTH, fh) == NULL) {
 337                          *err = file_error(fh);
 338                          if (*err == 0) {
 339                                  *err = WTAP_ERR_SHORT_READ;
 340                          }
 341                          return -1;
 342                  }
 343   
 344                  /* Check for "OFFSET 0001-0203" at beginning of line */
 345                  line[16] = '\0';
 346   
 347          } while (strcmp(line, "OFFSET 0001-0203") != 0);
 348   
 349          num_items_scanned = sscanf(line+64, "LEN=%d", &pkt_len);
 350          if (num_items_scanned != 1) {
 351                  *err = WTAP_ERR_BAD_RECORD;
 352                  *err_info = g_strdup("toshiba: OFFSET line doesn't have valid LEN item");
 353                  return -1;
 354          }
 355   
 356          if (wth) {
 357                  wth->phdr.ts.secs = hr * 3600 + min * 60 + sec;
 358                  wth->phdr.ts.nsecs = csec * 10000000;
 359                  wth->phdr.caplen = pkt_len;
 360                  wth->phdr.len = pkt_len;
 361          }
 362          switch (channel[0]) {
 363                  case 'B':
 364                          if (wth)
 365                                  wth->phdr.pkt_encap = WTAP_ENCAP_ISDN;
 366                          pseudo_header->isdn.uton = (direction[0] == 'T');
 367                          pseudo_header->isdn.channel = (guint8)
 368                              strtol(&channel[1], NULL, 10);
 369                          break;
 370   
 371                  case 'D':
 372                          if (wth)
 373                                  wth->phdr.pkt_encap = WTAP_ENCAP_ISDN;
 374                          pseudo_header->isdn.uton = (direction[0] == 'T');
 375                          pseudo_header->isdn.channel = 0;
 376                          break;
 377   
 378                  default:
 379                          if (wth)
 380                                  wth->phdr.pkt_encap = WTAP_ENCAP_ETHERNET;
 381                          /* XXX - is there an FCS in the frame? */
 382                          pseudo_header->eth.fcs_len = -1;
 383                          break;
 384          }
 385          return pkt_len;
 386  }
Show more  




Change Warning 1053.30028 : Unreachable Call

Priority:
State:
Finding:
Owner:
Note: