Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at pcapng.c:294

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

pcapng_read_option

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/pcapng.c)expand/collapse
Show more  
 262  pcapng_read_option(FILE_T fh, pcapng_t *pn, pcapng_option_header_t *oh,
 263                     char *content, int len, int *err, gchar **err_info _U_)
 264  {
 265          int     bytes_read;
 266          int     block_read;
 267          guint64 file_offset64;
 268   
 269   
 270          /* read option header */
 271          errno = WTAP_ERR_CANT_READ;
 272          bytes_read = file_read(oh, 1, sizeof (*oh), fh);
 273          if (bytes_read != sizeof (*oh)) {
 274              pcapng_debug0("pcapng_read_option: failed to read option");
 275              *err = file_error(fh);
 276              if (*err != 0)
 277                      return -1;
 278              return 0;
 279          }
 280          block_read = sizeof (*oh);
 281          if(pn->byte_swapped) {
 282                  oh->option_code      = BSWAP16(oh->option_code);
 283                  oh->option_length    = BSWAP16(oh->option_length);
 284          }
 285   
 286          /* sanity check: option length */
 287          if (oh->option_length > len) {
 288                  pcapng_debug2("pcapng_read_option: option_length %u larger than buffer (%u)",  
 289                                oh->option_length, len);
 290                  return 0;
 291          }
 292   
 293          /* read option content */
 294          errno = WTAP_ERR_CANT_READ;
 295          bytes_read = file_read(content, 1, oh->option_length, fh);
 296          if (bytes_read != oh->option_length) {
 297                  pcapng_debug1("pcapng_read_if_descr_block: failed to read content of option %u", oh->option_code);
 298                                *err = file_error(fh);
 299                  if (*err != 0)
 300                          return -1;
 301                  return 0;
 302          }
 303          block_read += oh->option_length;
 304   
 305          /* jump over potential padding bytes at end of option */
 306          if( (oh->option_length % 4) != 0) {
 307                  file_offset64 = file_seek(fh, 4 - (oh->option_length % 4), SEEK_CUR, err);
 308                  if (file_offset64 <= 0) {
 309                          if (*err != 0)
 310                                  return -1;
 311                          return 0;
 312                  }
 313                  block_read += 4 - (oh->option_length % 4);
 314          }
 315   
 316          return block_read;
 317  }
Show more  




Change Warning 1040.29754 : Useless Assignment

Priority:
State:
Finding:
Owner:
Note: