Text   |  XML   |  ReML   |   Visible Warnings:

Format String  at packet-enttec.c:306

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

dissect_enttec_dmx_data

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-enttec.c)expand/collapse
Show more  
 186  dissect_enttec_dmx_data(tvbuff_t *tvb, guint offset, proto_tree *tree)
 187  {
 188          const char* chan_format[] = {
 189                  "%2u ",
 190                  "%02x ",
 191                  "%3u "
 192          };
 193          const char* string_format[] = {
 194                  "%03x: %s",
 195                  "%3u: %s"
 196          };
 197   
 198          static guint8 dmx_data[512];
 199          static guint16 dmx_data_offset[513]; /* 1 extra for last offset */
 200          emem_strbuf_t *dmx_epstr;
 201   
 202          proto_tree *hi,*si;
 203          proto_item *item;
 204          guint16 length,r,c,row_count;
 205          guint8 v,type,count;
 206          guint16 ci,ui,i,start_offset,end_offset;
 207   
 208          proto_tree_add_item(tree, hf_enttec_dmx_data_universe, tvb,
 209                                          offset, 1, FALSE);
 210          offset += 1;
 211   
 212          proto_tree_add_item(tree, hf_enttec_dmx_data_start_code, tvb,
 213                                          offset, 1, FALSE);
 214          offset += 1;
 215   
 216          type = tvb_get_guint8(tvb, offset);      
 217          proto_tree_add_item(tree, hf_enttec_dmx_data_type, tvb,
 218                                          offset, 1, FALSE);
 219          offset += 1;
 220   
 221          length = tvb_get_ntohs(tvb, offset);
 222          proto_tree_add_item(tree, hf_enttec_dmx_data_size, tvb,
 223                                          offset, 2, FALSE);
 224          offset += 2;
 225   
 226          if (length > 512)
 227                  length = 512;
 228   
 229          if (type == ENTTEC_DATA_TYPE_RLE) {
 230                  /* uncompres the DMX data */
 231                  ui = 0;
 232                  ci = 0;
 233                  while (ci < length) {
 234                          v = tvb_get_guint8(tvb, offset+ci);
 235                          if (v == 0xFE) {
 236                                  ci++;
 237                                  count = tvb_get_guint8(tvb, offset+ci);
 238                                  ci++;
 239                                  v = tvb_get_guint8(tvb, offset+ci);
 240                                  ci++;
 241                                  for (i=0;i < count;i++) {
 242                                          dmx_data[ui] = v;
 243                                          dmx_data_offset[ui] = ci-3;
 244                                          ui++;
 245                                  }
 246                          } else if (v == 0xFD) {
 247                                  ci++;
 248                                  v = tvb_get_guint8(tvb, offset+ci);                              
 249                                  dmx_data[ui] = v;
 250                                  dmx_data_offset[ui] = ci;
 251                                  ci++;
 252                                  ui++;
 253                          } else {
 254                                  dmx_data[ui] = v;
 255                                  dmx_data_offset[ui] = ci;
 256                                  ui++;
 257                                  ci++;
 258                          }
 259                  }
 260                  dmx_data_offset[ui] = ci;
 261          } else {
 262                  for (ui=0; ui < length;ui++) {
 263                          dmx_data[ui] =  tvb_get_guint8(tvb, offset+ui);
 264                          dmx_data_offset[ui] = ui;
 265                  }
 266                  dmx_data_offset[ui] = ui;
 267          }  
 268   
 269   
 270          if (type == ENTTEC_DATA_TYPE_DMX || type == ENTTEC_DATA_TYPE_RLE) {
 271                  hi = proto_tree_add_item(tree,
 272                                          hf_enttec_dmx_data_data,
 273                                          tvb,
 274                                          offset,
 275                                          length,
 276                                          FALSE);
 277   
 278                  si = proto_item_add_subtree(hi, ett_enttec);
 279                           
 280                  row_count = (ui/global_disp_col_count) + ((ui%global_disp_col_count) == 0 ? 0 : 1);
 281                  dmx_epstr = ep_strbuf_new_label(NULL);
 282                  for (r=0; r < row_count;r++) {
 283                          for (c=0;(c < global_disp_col_count) && (((r*global_disp_col_count)+c) < ui);c++) {
 284                                  if ((c % (global_disp_col_count/2)) == 0) {
 285                                          ep_strbuf_append_c(dmx_epstr, ' ');
 286                                  }
 287                                  v = dmx_data[(r*global_disp_col_count)+c];
 288                                  if (global_disp_chan_val_type == 0) {
 289                                          v = (v * 100) / 255;
 290                                          if (v == 100) {
 291                                                  ep_strbuf_append(dmx_epstr, "FL ");
 292                                          } else {
 293                                                  ep_strbuf_append_printf(dmx_epstr, chan_format[global_disp_chan_val_type], v);
 294                                          }
 295                                  } else {
 296                                          ep_strbuf_append_printf(dmx_epstr, chan_format[global_disp_chan_val_type], v);
 297                                  }
 298                          }
 299   
 300                          start_offset = dmx_data_offset[(r*global_disp_col_count)];
 301                          end_offset = dmx_data_offset[(r*global_disp_col_count)+c];              
 302   
 303                          proto_tree_add_none_format(si,hf_enttec_dmx_data_dmx_data, tvb,
 304                                                  offset+start_offset,  
 305                                                  end_offset-start_offset,
 306                                                  string_format[global_disp_chan_nr_type], (r*global_disp_col_count)+1, dmx_epstr->str);
 307                          ep_strbuf_truncate(dmx_epstr, 0);
 308                  }
 309                   
 310                  item = proto_tree_add_item(si, hf_enttec_dmx_data_data_filter, tvb,
 311                                  offset, length, FALSE );
 312                  PROTO_ITEM_SET_HIDDEN(item);
 313                   
 314                  offset += length;
 315          } else if (type == ENTTEC_DATA_TYPE_CHAN_VAL) {
 316                  proto_tree_add_item(tree, hf_enttec_dmx_data_data_filter, tvb,
 317                                          offset, length, FALSE);
 318                  offset += length;
 319          } else {
 320                  proto_tree_add_item(tree, hf_enttec_dmx_data_data_filter, tvb,
 321                                          offset, length, FALSE);
 322                  offset += length;
 323          }                
 324   
 325           
 326                   
 327          return offset;
 328  }
Show more  




Change Warning 5568.35876 : Format String

Priority:
State:
Finding:
Owner:
Note: