From 4aada8b9eda25f3f024283c0c27c1424b5ba40ff Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 7 Dec 2019 13:47:05 -0700 Subject: Add memCHRs() macro and use it This replaces strchr("list", c) calls throughout the core. They don't work properly when 'c' is a NUL, returning the position of the terminating NUL in "list" instead of failure. This could lead to segfaults or even security issues. --- util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util.h') diff --git a/util.h b/util.h index 4b59c7e291..6294e590b8 100644 --- a/util.h +++ b/util.h @@ -17,7 +17,7 @@ (*(f) == '/' \ || (strchr(f,':') \ || ((*(f) == '[' || *(f) == '<') \ - && (isWORDCHAR((f)[1]) || strchr("$-_]>",(f)[1]))))) + && (isWORDCHAR((f)[1]) || memCHRs("$-_]>",(f)[1]))))) #elif defined(WIN32) || defined(__CYGWIN__) # define PERL_FILE_IS_ABSOLUTE(f) \ -- cgit v1.2.1