From 00231b1bca71f41b03dadd2303c318cbac82e4bc Mon Sep 17 00:00:00 2001 From: NRK Date: Sun, 7 May 2023 04:45:13 +0600 Subject: [PATCH] remove unnecessary filename length check 256 (or NAME_MAX) is not a reliable constant. furthermore, the "fileName" in this case can be a full path as well, so checking against NAME_MAX would be wrong regardless. Closes: https://github.com/resurrecting-open-source-projects/scrot/issues/247 --- src/options.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/options.c b/src/options.c index 8ed6763..d60ff34 100644 --- a/src/options.c +++ b/src/options.c @@ -59,20 +59,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "scrot_selection.h" #include "util.h" -#define STR_LEN_MAX_FILENAME(msg, fileName) do { \ - if (strlen((fileName)) > MAX_FILENAME) { \ - errx(EXIT_FAILURE, #msg " filename too long, must be " \ - "less than %d characters", MAX_FILENAME); \ - } \ -} while(0) - -#define checkMaxInputFileName(fileName) \ - STR_LEN_MAX_FILENAME(input, (fileName)) - -enum { - MAX_FILENAME = 256, // characters -}; - struct ScrotOptions opt = { .quality = 75, .lineStyle = LineSolid, @@ -226,7 +212,6 @@ static void optionsParseSelection(const char *optarg) if (errmsg) errx(EXIT_FAILURE, "option --select: '%s' is %s", value, errmsg); } else { // SELECTION_MODE_HIDE - checkMaxInputFileName(value); opt.selection.fileName = value; } }