Text   |  XML   |  ReML   |   Visible Warnings:

Redundant Condition  at ftype-integer.c:263

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

val64_from_unparsed

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/ftypes/ftype-integer.c)expand/collapse
Show more  
 255  val64_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFunc logfunc)
 256  {
 257          guint64 value;
 258          char    *endptr;
 259   
 260          errno = 0;
 261          value = g_ascii_strtoull(s, &endptr, 0);
 262   
 263          if (errno == EINVAL || endptr == s || *endptr != '\0') {
 264                  /* This isn't a valid number. */
 265                  if (logfunc != NULL)
 266                          logfunc("\"%s\" is not a valid number.", s);
 267                  return FALSE;
 268          }
 269          if (errno == ERANGE) {
 270                  if (logfunc != NULL) {
 271                          if (value == ULONG_MAX) {
 272                                  logfunc("\"%s\" causes an integer overflow.",
 273                                      s);
 274                          }
 275                          else {
 276                                  /*
 277                                   * XXX - can "strtoul()" set errno to 
 278                                   * ERANGE without returning ULONG_MAX?
 279                                   */
 280                                  logfunc("\"%s\" is not an integer.", s);
 281                          }
 282                  }
 283                  return FALSE;
 284          }
 285          if (value > G_MAXUINT64) {
 286                  /*
 287                   * Fits in an unsigned long, but not in a guint64 
 288                   * (unlikely, but not impossible).
 289                   */
 290                  if (logfunc != NULL)
 291                          logfunc("\"%s\" causes an integer overflow.", s);
 292                  return FALSE;
 293          }
 294   
 295          fv->value.integer64 = value;
 296          return TRUE;
 297  }
Show more  




Change Warning 1112.29559 : Redundant Condition

Priority:
State:
Finding:
Owner:
Note: