Commit: 8a8a63e974499c041f6e96359366cce56ae376bf Parent: e77527a649c7140554647b915a4b645d33a4fc5b Author: opask Date: Fri, 31 Aug 2018 21:47:58 -0600 dns.c: remove always true tests Diffstat:
M | dns.c | | | 9 | ++++----- |
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/dns.c b/dns.c @@ -36,13 +36,12 @@ static int get_addr_byte(const char *p, char *res, const char stp) char u = 0; if (!(*p >= '0' && *p <= '9')) return -1; - while (*p >= '0' && *p <= '9') { - u = u * 10 + *p - '0'; - if (u >= 256) + for (; *p >= '0' && *p <= '9'; p++) { + if (u * 10 + *p - '0' > 255) return -1; - p++; + u = u * 10 + *p - '0'; } - if (stp != 255 && *p != stp) return -1; + if (*p != stp) return -1; p++; *res = u; return 0;