From d5d61a8cc64b342d97e80ce7fe30e70556500f23 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sat, 10 Feb 2018 14:59:10 +1000 Subject: [PATCH] Fix a couple of bugs --- src/bbs.c | 2 +- src/strings.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bbs.c b/src/bbs.c index 870764e..cdf383f 100644 --- a/src/bbs.c +++ b/src/bbs.c @@ -1022,7 +1022,7 @@ tryagain: } void do_logout() { - char buffer[256]; + char buffer[PATH_MAX]; struct stat s; lua_State *L; int ret = 0; diff --git a/src/strings.c b/src/strings.c index f08ef2c..ece3ee1 100644 --- a/src/strings.c +++ b/src/strings.c @@ -10,7 +10,7 @@ char **strings; int string_count; void chomp(char *string) { - while ((string[strlen(string)-1] == '\r' || string[strlen(string)-1] == '\n') && strlen(string)) { + while (strlen(string) && (string[strlen(string)-1] == '\r' || string[strlen(string)-1] == '\n')) { string[strlen(string)-1] = '\0'; } }