| 99 | } |
| 100 | |
| 101 | static bool parse_maxhops(const char *s, u32 *v) |
| 102 | { |
| 103 | if(!is_maxhops(s)) |
| 104 | return false; |
| 105 | |
| 106 | const char *num = s + strlen("maxhops="); |
| 107 | char *end; |
| 108 | unsigned long n; |
| 109 | |
| 110 | if (*num < '0' || *num > '9') |
| 111 | return false; |
| 112 | errno = 0; |
| 113 | n = strtoul(num, &end, 10); |
| 114 | if (*end != '\0' || errno == ERANGE || n > UINT32_MAX) |
| 115 | return false; |
| 116 | *v = n; |
| 117 | return true; |
| 118 | } |
| 119 | |
| 120 | static u32 extract_maxhops(const char ***layers, u32 default_maxhops) |
| 121 | { |
no test coverage detected