Text   |  XML   |  ReML   |   Visible Warnings:

Unreachable Computation  at ftype-integer.c:105

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

val_from_unparsed

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/ftypes/ftype-integer.c)expand/collapse
Show more  
 65  val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFunc logfunc)
 66  {
 67          unsigned long value;
 68          char    *endptr;
 69   
 70          errno = 0;
 71          value = strtoul(s, &endptr, 0);
 72   
 73          if (errno == EINVAL || endptr == s || *endptr != '\0') {
 74                  /* This isn't a valid number. */
 75                  if (logfunc != NULL)
 76                          logfunc("\"%s\" is not a valid number.", s);
 77                  return FALSE;
 78          }
 79          if (errno == ERANGE) {
 80                  if (logfunc != NULL) {
 81                          if (value == ULONG_MAX) {
 82                                  logfunc("\"%s\" causes an integer overflow.",
 83                                      s);
 84                          }
 85                          else {
 86                                  /*
 87                                   * XXX - can "strtoul()" set errno to 
 88                                   * ERANGE without returning ULONG_MAX?
 89                                   */
 90                                  logfunc("\"%s\" is not an integer.", s);
 91                          }
 92                  }
 93                  return FALSE;
 94          }
 95          if (value > G_MAXUINT32) {
 96                  /*
 97                   * Fits in an unsigned long, but not in a guint32 
 98                   * (an unsigned long might be 64 bits).
 99                   */
 100                  if (logfunc != NULL)
 101                          logfunc("\"%s\" causes an integer overflow.", s);
 102                  return FALSE;
 103          }
 104   
 105          fv->value.uinteger = (guint32)value;
 106          return TRUE;
 107  }
Show more  




Change Warning 12263.29810 : Unreachable Computation

Priority:
State:
Finding:
Owner:
Note: