Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at ngsniffer.c:2475

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

ng_file_read

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/ngsniffer.c)expand/collapse
Show more  
 2405  ng_file_read(void *buffer, size_t elementsize, size_t numelements, wtap *wth,
 2406      gboolean is_random, int *err)
 2407  {
 2408      FILE_T infile;
 2409      ngsniffer_comp_stream_t *comp_stream;
 2410      size_t copybytes = elementsize * numelements; /* bytes left to be copied */
 2411      gint64 copied_bytes = 0; /* bytes already copied */
 2412      unsigned char *outbuffer = buffer; /* where to write next decompressed data */
 2413      blob_info_t *blob;
 2414      size_t bytes_to_copy;
 2415      size_t bytes_left;
 2416   
 2417      if (is_random) {
 2418          infile = wth->random_fh;
 2419          comp_stream = &wth->capture.ngsniffer->rand;
 2420      } else {
 2421          infile = wth->fh;
 2422          comp_stream = &wth->capture.ngsniffer->seq;
 2423      }
 2424   
 2425      if (wth->file_type == WTAP_FILE_NGSNIFFER_UNCOMPRESSED) {
 2426          errno = WTAP_ERR_CANT_READ;
 2427          copied_bytes = file_read(buffer, 1, copybytes, infile);
 2428          if ((size_t) copied_bytes != copybytes)
 2429              *err = file_error(infile);
 2430          return copied_bytes;
 2431      }
 2432   
 2433      /* Allocate the stream buffer if it hasn't already been allocated. */
 2434      if (comp_stream->buf == NULL) {
 2435          comp_stream->buf = g_malloc(OUTBUF_SIZE);
 2436   
 2437          if (is_random) {
 2438              /* This is the first read of the random file, so we're at 
 2439                 the beginning of the sequence of blobs in the file 
 2440                 (as we've not done any random reads yet to move the 
 2441                 current position in the random stream); set the
 2442                 current blob to be the first blob. */
 2443              wth->capture.ngsniffer->current_blob =
 2444                  wth->capture.ngsniffer->first_blob;
 2445
2454
Show [ Lines 2445 to 2454 omitted. ]
 2455                          g_list_append(wth->capture.ngsniffer->first_blob, blob);
 2456                  wth->capture.ngsniffer->last_blob =
 2457                          wth->capture.ngsniffer->first_blob;
 2458              }
 2459          }
 2460   
 2461          /* Now read the first blob into the buffer. */
 2462          if (read_blob(infile, comp_stream, err) < 0)
 2463              return -1;
 2464      }
 2465      while (copybytes > 0) {
 2466          bytes_left = comp_stream->nbytes - comp_stream->nextout;
 2467          if (bytes_left == 0) {
 2468              /* There's no decompressed stuff left to copy from the current 
 2469                 blob; get the next blob. */
 2470   
 2471              if (is_random) {
 2472                  /* Move to the next blob in the list. */
 2473                  wth->capture.ngsniffer->current_blob =
 2474                          g_list_next(wth->capture.ngsniffer->current_blob);
 2475                  blob = wth->capture.ngsniffer->current_blob->data;
Show more  




Change Warning 1033.29951 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: