diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/conf.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -1719,17 +1719,19 @@ conf_error_report(const char *msg) * Originally written by Dianora (Diane, db@db.net) */ time_t -valid_tkline(const char *p, int minutes) +valid_tkline(const char *data, const int minutes) { + const unsigned char *p = (const unsigned char *)data; + unsigned char tmpch = '\0'; time_t result = 0; - for (; *p; ++p) + while ((tmpch = *p++)) { - if (!IsDigit(*p)) + if (!IsDigit(tmpch)) return 0; result *= 10; - result += (*p & 0xF); + result += (tmpch & 0xF); } /* @@ -1745,12 +1747,12 @@ valid_tkline(const char *p, int minutes) * of this calculation */ if (!minutes) - result = result / (time_t)60; + result = result / 60; if (result > MAX_TDKLINE_TIME) result = MAX_TDKLINE_TIME; - result = result * (time_t)60; /* turn it into seconds */ + result = result * 60; /* turn it into seconds */ return result; } |