summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/conf.h2
-rw-r--r--src/conf.c14
2 files changed, 9 insertions, 7 deletions
diff --git a/include/conf.h b/include/conf.h
index ae9bc93..16a6766 100644
--- a/include/conf.h
+++ b/include/conf.h
@@ -386,7 +386,7 @@ extern int valid_comment(struct Client *, char *, int);
#define TK_SECONDS 0
#define TK_MINUTES 1
-extern time_t valid_tkline(const char *, int);
+extern time_t valid_tkline(const char *, const int);
extern int match_conf_password(const char *, const struct MaskItem *);
#define NOT_AUTHORIZED (-1)
diff --git a/src/conf.c b/src/conf.c
index 585cec8..3339d69 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -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;
}