Text   |  XML   |  ReML   |   Visible Warnings:

Unreachable Control Flow  at mate_util.c:1672

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

loal_from_file

(/home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/mate/mate_util.c)expand/collapse
Show more  
 1614  extern LoAL* loal_from_file(gchar* filename) {
 1615          FILE *fp = NULL;
 1616          gchar c;
 1617          int i = 0;
 1618          guint32 linenum = 1;
 1619          gchar linenum_buf[MAX_ITEM_LEN];
 1620          gchar name[MAX_ITEM_LEN];
 1621          gchar value[MAX_ITEM_LEN];
 1622          gchar op = '?';
 1623          LoAL *loal = new_loal(filename);
 1624          AVPL* curr = NULL;
 1625          AVP* avp;
 1626   
 1627          enum _load_loal_states {
 1628                  START,
 1629                  BEFORE_NAME,
 1630                  IN_NAME,
 1631                  IN_VALUE,
 1632                  MY_IGNORE 
 1633          } state;
 1634   
 1635  #ifndef _WIN32 
 1636          if (! getuid()) {
 1637                  return load_loal_error(fp,loal,curr,linenum,"MATE Will not run as root");
 1638          }
 1639  #endif
 1640   
 1641          state = START;
 1642   
 1643          if (( fp = ws_fopen(filename,"r") )) {
 1644                  while(( c = (gchar) fgetc(fp) )){
 1645   
 1646                          if ( feof(fp) ) {
 1647                                  if ( ferror(fp) ) {
 1648                                          report_read_failure(filename,errno);
 1649                                          return load_loal_error(fp,loal,curr,linenum,"Error while reading '%f'",filename);
 1650                                  }
 1651                                  break;
 1652                          }
 1653   
 1654                          if ( c == '\n' ) {
 1655                                  linenum++;
 1656                          }
 1657   
 1658                          if ( i >= MAX_ITEM_LEN - 1  ) {
 1659                                  return load_loal_error(fp,loal,curr,linenum,"Maximum item length exceeded");
 1660                          }
 1661   
 1662                          switch(state) {
 1663                                  case MY_IGNORE:
 1664                                          switch (c) {
 1665                                                  case '\n':
 1666                                                          state = START;
 1667                                                          i = 0;
 1668                                                          continue;
 1669                                                  default:
 1670                                                          continue;
 1671                                          }
 1672                                          continue;
 1673                                  case START:
 1674                                          switch (c) {
 1675                                                  case ' ': case '\t':
 1676                                                          /* ignore whitespace at line start */
 1677                                                          continue;
 1678                                                  case '\n':
 1679                                                          /* ignore empty lines */
 1680                                                          i = 0;
 1681                                                          continue;
 1682                                                  case AVP_NAME_CHAR:
 1683                                                          state = IN_NAME;
 1684                                                          i = 0;
 1685                                                          name[i++] = c;
 1686                                                          name[i] = '\0';
 1687                                                          g_snprintf(linenum_buf,sizeof(linenum_buf),"%s:%u",filename,linenum);
 1688                                                          curr = new_avpl(linenum_buf);
 1689                                                          continue;
 1690                                                  case '#':
 1691                                                          state = MY_IGNORE;
 1692                                                          continue;
 1693                                                  default:
 1694                                                          return load_loal_error(fp,loal,curr,linenum,"expecting name got: '%c'",c);
 1695                                          }
 1696                                  case BEFORE_NAME:
 1697                                          i = 0;
 1698                                          name[0] = '\0';
 1699                                          switch (c) {
 1700                                                  case '\\':
 1701                                                          c = fgetc(fp);
 1702                                                          if (c != '\n') ungetc(c,fp);
 1703                                                          continue;
 1704                                                  case ' ':
 1705                                                  case '\t':
 1706                                                          continue;
 1707                                                  case AVP_NAME_CHAR:
 1708                                                          state = IN_NAME;
 1709   
 1710                                                          name[i++] = c;
 1711                                                          name[i] = '\0';
 1712                                                          continue;
 1713                                                  case '\n':
 1714                                                          loal_append(loal,curr);
 1715                                                          state = START;
 1716                                                          continue;
 1717                                                  default:
 1718                                                          return load_loal_error(fp,loal,curr,linenum,"expecting name got: '%c'",c);
 1719                                          }
 1720                                          case IN_NAME:
 1721                                                  switch (c) {
 1722                                                          case ';':
 1723                                                                  state = BEFORE_NAME;
 1724   
 1725                                                                  op = '?';
 1726                                                                  name[i] = '\0';
 1727                                                                  value[0] = '\0';
 1728                                                                  i = 0;
 1729   
 1730                                                                  avp = new_avp(name,value,op);
 1731   
 1732                                                                  if (! insert_avp(curr,avp) ) {
 1733                                                                          delete_avp(avp);
 1734                                                                  }
 1735   
 1736                                                                  continue;
 1737                                                          case AVP_OP_CHAR:
 1738                                                                  name[i] = '\0';
 1739                                                                  i = 0;
 1740                                                                  op = c;
 1741                                                                  state = IN_VALUE;
 1742                                                                  continue;
 1743                                                          case AVP_NAME_CHAR:
 1744                                                                  name[i++] = c;
 1745                                                                  continue;
 1746                                                          case '\n':
 1747                                                                  return load_loal_error(fp,loal,curr,linenum,"operator expected found new line");
 1748                                                          default:
 1749                                                                  return load_loal_error(fp,loal,curr,linenum,"name or match operator expected found '%c'",c);
 1750                                                  }
 1751                                          case IN_VALUE:
 1752                                                  switch (c) {
 1753                                                          case '\\':
 1754                                                                  value[i++] = fgetc(fp);
 1755                                                                  continue;
 1756                                                          case ';':
 1757                                                                  state = BEFORE_NAME;
 1758   
 1759                                                                  value[i] = '\0';
 1760                                                                  i = 0;
 1761   
 1762                                                                  avp = new_avp(name,value,op);
 1763   
 1764                                                                  if (! insert_avp(curr,avp) ) {
 1765                                                                          delete_avp(avp);
 1766                                                                  }
 1767                                                                  continue;
 1768                                                          case '\n':
 1769                                                                  return load_loal_error(fp,loal,curr,linenum,"';' expected found new line");
 1770                                                          default:
 1771                                                                  value[i++] = c;
 1772                                                                  continue;
 1773                                                  }
 1774                          }
 1775                  }
 1776                  fclose (fp);
 1777   
 1778                  return loal;
 1779   
 1780          } else {
 1781                  report_open_failure(filename,errno,FALSE);
 1782                  return load_loal_error(NULL,loal,NULL,0,"Cannot Open file '%s'",filename);
 1783          }
 1784  }
Show more  




Change Warning 3741.30319 : Unreachable Control Flow

Priority:
State:
Finding:
Owner:
Note: