From 20fadce465934eea357259366a6d106e5c88fa4a Mon Sep 17 00:00:00 2001 From: gransom Date: Tue, 25 Jun 2024 10:55:22 -0600 Subject: [PATCH] Minor adjustment of restricted chars and addition of restricted char check for manual ctag adjustment --- src/api/marfs.c | 6 ++++++ src/general_include/restrictedchars.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api/marfs.c b/src/api/marfs.c index 6886523c..45edd528 100644 --- a/src/api/marfs.c +++ b/src/api/marfs.c @@ -319,6 +319,12 @@ int marfs_setctag( marfs_ctxt ctxt, const char* ctag ) { LOG( LOG_INFO, "EXIT - Failure w/ \"%s\"\n", strerror(errno) ); return -1; } + if ( restrictedchars_check( ctag ) ) { + LOG( LOG_ERR, "Received a ctag string containing restricted characters\n" ); + errno = EINVAL; + LOG( LOG_INFO, "EXIT - Failure w/ \"%s\"\n", strerror(errno) ); + return -1; + } // duplicate the client string char* newctag = strdup( ctag ); if ( newctag == NULL ) { diff --git a/src/general_include/restrictedchars.h b/src/general_include/restrictedchars.h index 475178db..8352765c 100644 --- a/src/general_include/restrictedchars.h +++ b/src/general_include/restrictedchars.h @@ -64,7 +64,7 @@ GNU licenses can be found at http://www.gnu.org/licenses/. // NOTE: This file is intended for direct, inline inclusion in other SRC files -#define RESTRICTEDCHARS_STRING "/()|#" +#define RESTRICTEDCHARS_STRING "/()|#^*" // parse over a provided string to check for restricted chars int restrictedchars_check( const char* str ) {