| 27 | | FALSE - field is invalid |
| 28 | +--------------------------------------------------------------------------*/ |
| 29 | static bool Check_IPV4_Field(FIELD * field, const void * argp) |
| 30 | { |
| 31 | char *bp = field_buffer(field,0); |
| 32 | int num = 0, len; |
| 33 | unsigned int d1=256, d2=256, d3=256, d4=256; |
| 34 | |
| 35 | argp=0; /* Silence unused parameter warning. */ |
| 36 | |
| 37 | if(isdigit((int)(*bp))) /* Must start with digit */ |
| 38 | { |
| 39 | num = sscanf(bp, "%u.%u.%u.%u%n", &d1, &d2, &d3, &d4, &len); |
| 40 | if (num == 4) |
| 41 | { |
| 42 | bp += len; /* Make bp point to what sscanf() left */ |
| 43 | while (*bp && isspace((int)(*bp))) |
| 44 | bp++; /* Allow trailing whitespace */ |
| 45 | } |
| 46 | } |
| 47 | return ((num != 4 || *bp || d1 > 255 || d2 > 255 |
| 48 | || d3 > 255 || d4 > 255) ? FALSE : TRUE); |
| 49 | } |
| 50 | |
| 51 | /*--------------------------------------------------------------------------- |
| 52 | | Facility : libnform |
nothing calls this directly
no test coverage detected
searching dependent graphs…