From 8beb891218a50515b6a7c51f01608eaf2acc3f97 Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 14 Oct 2024 23:07:48 +0200 Subject: [PATCH] Mon 14 Oct 23:06:38 CEST 2024 --- kernel/is_valid.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 kernel/is_valid.h diff --git a/kernel/is_valid.h b/kernel/is_valid.h new file mode 100644 index 0000000..6101900 --- /dev/null +++ b/kernel/is_valid.h @@ -0,0 +1,35 @@ +/* +Copyright (C) 2016-2019 The University of Notre Dame +This software is distributed under the GNU General Public License. +See the file LICENSE for details. +*/ + +#ifndef IS_VALID_H +#define IS_VALID_H + +#include "kobject.h" + +// Does this string comprise a valid path? +int is_valid_path(const char *s); + +// Does this string comprise a valid tag? +int is_valid_tag(const char *s); + +// Does this string point to a valid resource (i.e. is it a legitimate +// tag-path concatenation)? +int is_valid_location(const char *s); + +// Return true if file desciptor is in range and refers to a live object. +int is_valid_object( int fd ); + +// Return true if fd valid and object is also of indicated type. +int is_valid_object_type( int fd, kobject_type_t type ); + +// Return true if (ptr,length) describes a valid area in user space. +int is_valid_pointer( void *ptr, int length ); + +// Return true if string points to a valid area in user space. +int is_valid_string( const char *str ); + + +#endif