summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-05-28 20:57:17 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-05-28 20:57:17 +0100
commit8a9732c33888462d6fb34f693688e43ff1e31eaa (patch)
treeb9e41d4246d98f50f4e1580490e2bd6eed9b7e0d
parent31ce10b31198128de4983667820319a193adb976 (diff)
Fix BLABOUNCER REPLAY time values of "0" (e.g. 1:00:00 for one hour).
-rw-r--r--TODO4
-rw-r--r--blabouncer.c8
2 files changed, 9 insertions, 3 deletions
diff --git a/TODO b/TODO
index e1b7253..419dd3d 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-Move debug output into some debug function that can be enabled/disabled.
+Allow debugging to file as well as to screen.
Add various auto replay options:
- All logs since the final client disconnected
@@ -10,3 +10,5 @@ Add various auto replay options:
Might need to #include <limits.h> in blabouncer.c to make some operating systems and/or compilers happy.
Send a PING to the server before assuming a timeout is definite.
+
+Implement daemon (background) mode.
diff --git a/blabouncer.c b/blabouncer.c
index e67c083..5fa2e5d 100644
--- a/blabouncer.c
+++ b/blabouncer.c
@@ -1915,8 +1915,12 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli
// Make sure all the components are numbers
for (int i = 0; i < timecounter; i++) {
- int check;
- if ((check = strtol(timetokens[i], NULL, 10)) == 0) {
+ // Temporary number and pointer for checking errors
+ long check;
+ char *str_end;
+ errno = 0;
+ check = strtol(timetokens[i], &str_end, 10);
+ if (str_end == timetokens[i] || ((check == LONG_MAX || check == LONG_MIN) && errno == ERANGE)) {
debugprint("Invalid number '%s' requested by REPLAY command. Telling client.\n", timetokens[i]);
if (!snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Invalid number '%s' requested by REPLAY command.", ircdstrings->ircnick, timetokens[i])) {
fprintf(stderr, "Error while preparing REPLAY invalid number response!\n");