Text   |  XML   |  ReML   |   Visible Warnings:

Uninitialized Variable  at packet-mq.c:2239

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

dissect_mq_pdu

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-mq.c)expand/collapse
Show more  
 1230  dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 1231  {
 1232          proto_tree      *mq_tree = NULL;
 1233          proto_tree      *mqroot_tree = NULL;
 1234          proto_item      *ti = NULL;
 1235          gint offset = 0;
 1236          guint32 structId = MQ_STRUCTID_NULL;
 1237          guint8 opcode;
 1238          guint32 iSegmentLength = 0;
 1239          guint32 iSizePayload = 0;
 1240          gint iSizeMD = 0;
 1241          gboolean bLittleEndian = FALSE;
 1242          gboolean bPayload = FALSE;
 1243          gboolean bEBCDIC = FALSE;
 1244          gint iDistributionListSize = 0;
 1245          struct mq_msg_properties tMsgProps;
 1246          static gint iPreviousFrameNumber = -1;
 1247   
 1248          if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "MQ");
 1249[+]         if (check_col(pinfo->cinfo, COL_INFO))
 1250          {
 1251                  /* This is a trick to know whether this is the first PDU in this packet or not */
 1252                  if (iPreviousFrameNumber != (gint) pinfo->fd->num)
 1253                          col_clear(pinfo->cinfo, COL_INFO);
 1254                  else 
 1255                          col_append_str(pinfo->cinfo, COL_INFO, " | ");
 1256          }
 1257          iPreviousFrameNumber = pinfo->fd->num;
 1258          if (tvb_length(tvb) >= 4)
 1259          {
 1260[+]                 structId = tvb_get_ntohl(tvb, offset);
 1261[+]                 if ((structId == MQ_STRUCTID_TSH || structId == MQ_STRUCTID_TSH_EBCDIC) && tvb_length_remaining(tvb, offset) >= 28)
 1262                  {
 1263                          /* An MQ packet always starts with this structure*/
 1264                          gint iSizeTSH = 28;
 1265                          guint8 iControlFlags = 0;
 1266                          if (structId == MQ_STRUCTID_TSH_EBCDIC) bEBCDIC = TRUE;
 1267[+]                         opcode = tvb_get_guint8(tvb, offset + 9);
 1268[+]                         bLittleEndian = (tvb_get_guint8(tvb, offset + 8) == MQ_LITTLE_ENDIAN ? TRUE : FALSE);
 1269                          iSegmentLength = tvb_get_ntohl(tvb, offset + 4);
 1270                          iControlFlags = tvb_get_guint8(tvb, offset + 10);
 1271   
 1272[+]                         if (check_col(pinfo->cinfo, COL_INFO))
 1273                          {
 1274                                  col_append_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, mq_opcode_vals, "Unknown (0x%02x)"));
 1275                          }
 1276   
 1277                          if (tree)
 1278                          {
 1279                                  ti = proto_tree_add_item(tree, proto_mq, tvb, offset, -1, FALSE);
 1280                                  proto_item_append_text(ti, " (%s)", val_to_str(opcode, mq_opcode_vals, "Unknown (0x%02x)"));
 1281                                  if (bEBCDIC == TRUE) proto_item_append_text(ti, " (EBCDIC)");
 1282                                  mqroot_tree = proto_item_add_subtree(ti, ett_mq);
 1283   
 1284                                  ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeTSH, MQ_TEXT_TSH);
 1285                                  mq_tree = proto_item_add_subtree(ti, ett_mq_tsh);
 1286   
 1287                                  proto_tree_add_item(mq_tree, hf_mq_tsh_structid, tvb, offset + 0, 4, FALSE);
 1288
1306
Show [ Lines 1288 to 1306 omitted. ]
 1307                                          proto_tree_add_boolean(mq_tree_sub, hf_mq_tsh_tcf_error, tvb, offset + 10, 1, iControlFlags);
 1308                                          proto_tree_add_boolean(mq_tree_sub, hf_mq_tsh_tcf_confirmreq, tvb, offset + 10, 1, iControlFlags);
 1309                                  }
 1310   
 1311                                  proto_tree_add_item(mq_tree, hf_mq_tsh_reserved, tvb, offset + 11, 1, FALSE);
 1312                                  proto_tree_add_item(mq_tree, hf_mq_tsh_luwid, tvb, offset + 12, 8, FALSE);
 1313                                  proto_tree_add_item(mq_tree, hf_mq_tsh_encoding, tvb, offset + 20, 4, bLittleEndian);
 1314                                  proto_tree_add_item(mq_tree, hf_mq_tsh_ccsid, tvb, offset + 24, 2, bLittleEndian);
 1315                                  proto_tree_add_item(mq_tree, hf_mq_tsh_padding, tvb, offset + 26, 2, FALSE);
 1316                          }
 1317                          offset += iSizeTSH;
 1318   
 1319                          /* Now dissect the embedded structures */
 1320[+]                         if (tvb_length_remaining(tvb, offset) >= 4)
 1321                          {
 1322                                  structId = tvb_get_ntohl(tvb, offset);
 1323                                  if (((iControlFlags & MQ_TCF_FIRST) != 0) || opcode < 0x80)
 1324                                  {
 1325                                          /* First MQ segment (opcodes below 0x80 never span several TSH) */
 1326                                          gint iSizeAPI = 16;
 1327                                          if (opcode >= 0x80 && opcode <= 0x9F && tvb_length_remaining(tvb, offset) >= 16)
 1328                                          {
 1329                                                  guint32 iReturnCode = 0;
 1330                                                  iReturnCode = tvb_get_guint32_endian(tvb, offset + 8, bLittleEndian);
 1331                                                  if (check_col(pinfo->cinfo, COL_INFO))
 1332                                                  {
 1333                                                          if (iReturnCode != 0)
 1334                                                                  col_append_fstr(pinfo->cinfo, COL_INFO, " [RC=%d]", iReturnCode);
 1335                                                  }
 1336   
 1337                                                  if (tree)
 1338                                                  {
 1339                                                          ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeAPI, MQ_TEXT_API);
 1340                                                          mq_tree = proto_item_add_subtree(ti, ett_mq_api);
 1341   
 1342                                                          proto_tree_add_item(mq_tree, hf_mq_api_replylength, tvb, offset, 4, FALSE);
 1343                                                          proto_tree_add_item(mq_tree, hf_mq_api_completioncode, tvb, offset + 4, 4, bLittleEndian);
 1344                                                          proto_tree_add_item(mq_tree, hf_mq_api_reasoncode, tvb, offset + 8, 4, bLittleEndian);
 1345                                                          proto_tree_add_item(mq_tree, hf_mq_api_objecthandle, tvb, offset + 12, 4, bLittleEndian);
 1346                                                  }
 1347                                                  offset += iSizeAPI;
 1348                                                  structId = (tvb_length_remaining(tvb, offset) >= 4) ? tvb_get_ntohl(tvb, offset) : MQ_STRUCTID_NULL;
 1349                                          }
 1350                                          if ((structId == MQ_STRUCTID_MSH || structId == MQ_STRUCTID_MSH_EBCDIC) && tvb_length_remaining(tvb, offset) >= 20)
 1351                                          {
 1352                                                  gint iSizeMSH = 20;
 1353[+]                                                 iSizePayload = tvb_get_guint32_endian(tvb, offset + 16, bLittleEndian);
 1354                                                  bPayload = TRUE;
 1355                                                  if (tree)
 1356                                                  {
 1357                                                          ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeMSH, MQ_TEXT_MSH);
 1358                                                          mq_tree = proto_item_add_subtree(ti, ett_mq_msh);
 1359   
 1360                                                          proto_tree_add_item(mq_tree, hf_mq_msh_structid, tvb, offset + 0, 4, FALSE);
 1361                                                          proto_tree_add_item(mq_tree, hf_mq_msh_seqnum, tvb, offset + 4, 4, bLittleEndian);
 1362                                                          proto_tree_add_item(mq_tree, hf_mq_msh_datalength, tvb, offset + 8, 4, bLittleEndian);
 1363                                                          proto_tree_add_item(mq_tree, hf_mq_msh_unknown1, tvb, offset + 12, 4, bLittleEndian);
 1364                                                          proto_tree_add_item(mq_tree, hf_mq_msh_msglength, tvb, offset + 16, 4, bLittleEndian);
 1365                                                  }
 1366                                                  offset += iSizeMSH;
 1367                                          }
 1368                                          else if (opcode == MQ_TST_STATUS && tvb_length_remaining(tvb, offset) >= 8)
 1369                                          {
 1370                                                  /* Some status are 28 bytes long and some are 36 bytes long */
 1371                                                  guint32 iStatus = 0;
 1372                                                  gint iStatusLength = 0;
 1373                                                  iStatus = tvb_get_guint32_endian(tvb, offset + 4, bLittleEndian);
 1374                                                  iStatusLength = tvb_get_guint32_endian(tvb, offset, bLittleEndian);
 1375   
 1376                                                  if (tvb_length_remaining(tvb, offset) >= iStatusLength)
 1377
1903
Show [ Lines 1377 to 1903 omitted. ]
 1904                                                          {
 1905                                                                  if (tree)
 1906                                                                  {
 1907                                                                          proto_tree_add_item(mq_tree, hf_mq_uid_longuserid, tvb, offset + 28, 64, FALSE);
 1908                                                                          proto_tree_add_item(mq_tree, hf_mq_uid_securityid, tvb, offset + 92, 40, FALSE);
 1909                                                                  }
 1910                                                          }
 1911                                                          offset += iSizeUID;
 1912                                                  }
 1913                                          }
 1914[+]                                         if ((structId == MQ_STRUCTID_OD || structId == MQ_STRUCTID_OD_EBCDIC) && tvb_length_remaining(tvb, offset) >= 8)
 1915                                          {
 1916                                                  /* The OD struct can be present in several messages at different levels */
 1917                                                  gint iSizeOD = 0;
 1918                                                  guint32 iVersionOD = 0;
 1919                                                  iVersionOD = tvb_get_guint32_endian(tvb, offset + 4, bLittleEndian);
 1920                                                  /* Compute length according to version */
 1921                                                  switch (iVersionOD)
 1922                                                  {
 1923                                                          case 1: iSizeOD = 168; break;
 1924                                                          case 2: iSizeOD = 200; break;
 1925
1985
Show [ Lines 1925 to 1985 omitted. ]
 1986                                                                  iOffsetOR = tvb_get_guint32_endian(tvb, offset - iSizeOD + 184, bLittleEndian);
 1987                                                                  iOffsetRR = tvb_get_guint32_endian(tvb, offset - iSizeOD + 188, bLittleEndian);
 1988                                                                  if ((iSizeORRR = dissect_mq_or(tvb, mqroot_tree, offset, iNbrRecords, iOffsetOR)) != 0)
 1989                                                                          offset += iSizeORRR;
 1990                                                                  if ((iSizeORRR = dissect_mq_rr(tvb, mqroot_tree, bLittleEndian, offset, iNbrRecords, iOffsetRR)) != 0)
 1991                                                                          offset += iSizeORRR;
 1992                                                          }
 1993                                                  }
 1994                                                  structId = (tvb_length_remaining(tvb, offset) >= 4) ? tvb_get_ntohl(tvb, offset) : MQ_STRUCTID_NULL;
 1995                                          }
 1996                                          if ((opcode == MQ_TST_MQOPEN || opcode == MQ_TST_MQCLOSE 
 1997                                                  || opcode == MQ_TST_MQOPEN_REPLY || opcode == MQ_TST_MQCLOSE_REPLY)
 1998[+]                                                 && tvb_length_remaining(tvb, offset) >= 4)
 1999                                          {
 2000                                                  if (tree)
 2001                                                  {
 2002                                                          ti = proto_tree_add_text(mqroot_tree, tvb, offset, 4, MQ_TEXT_OPEN);
 2003                                                          mq_tree = proto_item_add_subtree(ti, ett_mq_open);
 2004                                                          proto_tree_add_item(mq_tree, hf_mq_open_options, tvb, offset, 4, bLittleEndian);
 2005                                                  }
 2006                                                  offset += 4;
 2007                                                  structId = (tvb_length_remaining(tvb, offset) >= 4) ? tvb_get_ntohl(tvb, offset) : MQ_STRUCTID_NULL;
 2008                                          }
 2009[+]                                         if ((iSizeMD = dissect_mq_md(tvb, mqroot_tree, bLittleEndian, offset, &tMsgProps)) != 0)
 2010                                          {
 2011                                                  gint iSizeGMO = 0;
 2012                                                  gint iSizePMO = 0;
 2013                                                  offset += iSizeMD;
 2014   
 2015                                                  if ((iSizeGMO = dissect_mq_gmo(tvb, pinfo, mqroot_tree, bLittleEndian, offset)) != 0)
 2016                                                  {
 2017                                                          offset += iSizeGMO;
 2018                                                          bPayload = TRUE;
 2019                                                  }
 2020
2029
Show [ Lines 2020 to 2029 omitted. ]
 2030                                                                  if (tree)
 2031                                                                  {
 2032                                                                          ti = proto_tree_add_text(mqroot_tree, tvb, offset, 4, MQ_TEXT_PUT);
 2033                                                                          mq_tree = proto_item_add_subtree(ti, ett_mq_put);
 2034                                                                          proto_tree_add_item(mq_tree, hf_mq_put_length, tvb, offset, 4, bLittleEndian);
 2035                                                                  }
 2036                                                                  offset += 4;
 2037                                                          }
 2038                                                  }
 2039                                          }
 2040                                          if (iDistributionListSize > 0)
 2041                                          {
 2042                                                  if (check_col(pinfo->cinfo, COL_INFO))
 2043                                                          col_append_fstr(pinfo->cinfo, COL_INFO, " (Distribution List, Size=%d)", iDistributionListSize);
 2044                                          }
 2045                                          if (bPayload == TRUE)
 2046                                          {
 2047[+]                                                 if (iSizePayload != 0 && tvb_length_remaining(tvb, offset) > 0)
 2048                                                  {
 2049                                                          /* For the following header structures, each structure has a "format" field 
 2050                                                             which announces the type of the following structure.  For dissection we
 2051                                                             do not use it and rely on the structid instead. */
 2052                                                          guint32 iHeadersLength = 0;
 2053                                                          if (tvb_length_remaining(tvb, offset) >= 4)
 2054                                                          {
 2055                                                                  gint iSizeMD = 0;
 2056                                                                  structId = tvb_get_ntohl(tvb, offset);
 2057   
 2058                                                                  if ((structId == MQ_STRUCTID_XQH || structId == MQ_STRUCTID_XQH_EBCDIC) && tvb_length_remaining(tvb, offset) >= 104)
 2059                                                                  {
 2060                                                                          /* if MD.format == MQXMIT */
 2061                                                                          gint iSizeXQH = 104;
 2062                                                                          if (tree)
 2063                                                                          {
 2064
2228
Show [ Lines 2064 to 2228 omitted. ]
 2229                                                                                          proto_tree_add_item(mq_tree, hf_mq_head_struct, tvb, offset + 32, iSizeHeader - 32, bLittleEndian);
 2230   
 2231                                                                                  }
 2232                                                                                  offset += iSizeHeader;
 2233                                                                                  iHeadersLength += iSizeHeader;
 2234                                                                                  structId = (tvb_length_remaining(tvb, offset) >= 4) ? tvb_get_ntohl(tvb, offset) : MQ_STRUCTID_NULL;
 2235                                                                          }
 2236                                                                  }
 2237                                                          }
 2238   
 2239                                                          if (tMsgProps.iOffsetFormat != 0)
Show more  




Change Warning 12398.33805 : Uninitialized Variable

Priority:
State:
Finding:
Owner:
Note: