Text   |  XML   |  ReML   |   Visible Warnings:

Unreachable Data Flow  at pppdump.c:420

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

process_data

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/pppdump.c)expand/collapse
Show more  
 374  process_data(pppdump_t *state, FILE_T fh, pkt_t *pkt, int n, guint8 *pd,
 375      int *err, pkt_id *pid)
 376  {
 377          int     c;
 378          int     num_bytes = n;
 379          int     num_written;
 380   
 381          for (; num_bytes > 0; --num_bytes) {
 382                  c = file_getc(fh);
 383                  if (c == EOF) {
 384                          *err = file_error(fh);
 385                          if (*err == 0) {
 386                                  *err = WTAP_ERR_SHORT_READ;
 387                          }
 388                          return -1;
 389                  }
 390                  state->offset++;
 391                  switch (c) {
 392                          case 0x7e:
 393                                  /*
 394                                   * Flag Sequence for RFC 1662 HDLC-like
 395                                   * framing.
 396                                   *
 397                                   * As this is a raw trace of octets going 
 398                                   * over the wire, and that might include
 399                                   * the  sequence, there is no 
 400                                   * guarantee that *only* PPP traffic
 401                                   * appears in this file, so there is no
 402                                   * guarantee that the first 0x7e we see is
 403                                   * a start flag sequence, and therefore we 
 404                                   * cannot safely ignore all characters up
 405                                   * to the first 0x7e, and therefore we 
 406                                   * might end up with some bogus PPP 
 407                                   * packets.
 408                                   */
 409                                  if (pkt->cnt > 0) {
 410                                          /*
 411                                           * We've seen stuff before this,
 412                                           * so this is the end of a frame.
 413                                           * Make a frame out of that stuff.
 414                                           */
 415                                          pkt->esc = FALSE;
 416   
 417                                          num_written = pkt->cnt;
 418                                          pkt->cnt = 0;
 419                                          if (num_written <= 0) {
 420                                                  return 0;
 421                                          }
 422   
 423                                          if (num_written > PPPD_BUF_SIZE) {
 424                                                  *err = WTAP_ERR_UNC_OVERFLOW;
 425                                                  return -1;
 426                                          }
 427   
 428                                          memcpy(pd, pkt->buf, num_written);
 429   
 430                                          /*
 431                                           * Remember the offset of the 
 432                                           * first record containing data
 433                                           * for this packet, and how far 
 434                                           * into that record to skip to
 435                                           * get to the beginning of the
 436                                           * data for this packet; the number
 437                                           * of bytes to skip into that record 
 438                                           * is the file offset of the first 
 439                                           * byte of this packet minus the
 440                                           * file offset of the first byte of 
 441                                           * this record, minus 3 bytes for the 
 442                                           * header of this record (which, if 
 443                                           * we re-read this record, we will
 444                                           * process, not skip).
 445                                           */
 446                                          if (pid) {
 447                                                  pid->offset = pkt->id_offset;
 448                                                  pid->num_bytes_to_skip =
 449                                                      pkt->sd_offset - pkt->id_offset - 3;
 450                                                  g_assert(pid->num_bytes_to_skip >= 0);
 451                                          }
 452   
 453                                          num_bytes--;
 454                                          if (num_bytes > 0) {
 455                                                  /*
 456                                                   * There's more data in this
 457                                                   * record.
 458                                                   * Set the initial data offset 
 459                                                   * for the next packet.
 460                                                   */
 461                                                  pkt->id_offset = pkt->cd_offset;
 462                                                  pkt->sd_offset = state->offset;
 463                                          } else {
 464                                                  /*
 465                                                   * There is no more data in
 466                                                   * this record.
 467                                                   * Thus, we don't have the
 468                                                   * initial data offset for
 469                                                   * the next packet.
 470                                                   */
 471                                                  pkt->id_offset = 0;
 472                                                  pkt->sd_offset = 0;
 473                                          }
 474                                          state->num_bytes = num_bytes;
 475                                          state->pkt = pkt;
 476                                          return num_written;
 477                                  }
 478                                  break;
 479   
 480                          case 0x7d:
 481                                  /*
 482                                   * Control Escape octet for octet-stuffed
 483                                   * RFC 1662 HDLC-like framing.
 484                                   */
 485                                  if (!pkt->esc) {
 486                                          /*
 487                                           * Control Escape not preceded by 
 488                                           * Control Escape; discard it
 489                                           * but XOR the next octet with
 490                                           * 0x20.
 491                                           */
 492                                          pkt->esc = TRUE;
 493                                          break;
 494                                  }
 495                                  /*
 496                                   * Control Escape preceded by Control Escape;
 497                                   * treat it as an ordinary character,
 498                                   * by falling through.
 499                                   */
 500   
 501                          default:
 502                                  if (pkt->esc) {
 503                                          /*
 504                                           * This character was preceded by 
 505                                           * Control Escape, so XOR it with
 506                                           * 0x20, as per RFC 1662's octet-
 507                                           * stuffed framing, and clear
 508                                           * the flag saying that the 
 509                                           * character should be escaped.
 510                                           */
 511                                          c ^= 0x20;
 512                                          pkt->esc = FALSE;
 513                                  }
 514   
 515                                  pkt->buf[pkt->cnt++] = c;
 516                                  if (pkt->cnt > PPPD_BUF_SIZE) {
 517                                          *err = WTAP_ERR_UNC_OVERFLOW;
 518                                          return -1;
 519                                  }
 520                                  break;
 521                  }
 522          }
 523   
 524          /* we could have run out of bytes to read */
 525          return 0;
 526  }
Show more  




Change Warning 1049.29671 : Unreachable Data Flow

Priority:
State:
Finding:
Owner:
Note: