--- lbbs/src/bwf.c 2025/11/07 06:32:50 1.3 +++ lbbs/src/bwf.c 2025/11/11 00:28:05 1.5 @@ -6,6 +6,10 @@ * Copyright (C) 2004-2025 Leaflet */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #define PCRE2_CODE_UNIT_WIDTH 8 #include "bwf.h" @@ -56,9 +60,15 @@ int bwf_load(const char *filename) return -3; } - if (line[len_line - 1] == '\n') + while (len_line > 0 && (line[len_line - 1] == '\n' || line[len_line - 1] == '\r')) { line[len_line - 1] = '\0'; + len_line--; + } + + if (len_line == 0) + { + continue; } if (p > bwf_pattern_str)