improve includes and fix a false-positive warning for clang - geomyidae - A small C-based gopherd. HTML git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 41aaba3aa82bbe810c1008246b2b226e7395fe1e DIR parent 759d3017c73af279f7e0cec80f328e8da78d397d HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Sat, 22 Jul 2023 20:16:12 +0200 improve includes and fix a false-positive warning for clang Tested on OpenBSD libgen.h is needed for basename(). limits.h is needed for PATH_MAX. Signed-off-by: Christoph Lohmann <20h@r-36.net> Diffstat: M ind.c | 1 + M main.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) --- DIR diff --git a/ind.c b/ind.c @@ -7,6 +7,7 @@ #define _GNU_SOURCE #endif +#include <libgen.h> #include <unistd.h> #include <stdarg.h> #include <string.h> DIR diff --git a/main.c b/main.c @@ -3,6 +3,7 @@ * by 20h */ +#include <limits.h> #include <unistd.h> #include <dirent.h> #include <memory.h> @@ -346,7 +347,7 @@ dothegopher: for (i = 0; i < sizeof(indexf)/sizeof(indexf[0]); i++) { len = strlen(rpath); - if (len + strlen(indexf[i]) + (rpath[len-1] == '/')? 0 : 1 + if (len + strlen(indexf[i]) + ((rpath[len-1] == '/')? 0 : 1) >= sizeof(rpath)) { if (loglvl & ERRORS) { logentry(clienth, clientp,