From 368e507e16c1fdcf23f608cec4e1c31b7372319a Mon Sep 17 00:00:00 2001 From: AZero13 Date: Wed, 17 Dec 2025 19:09:03 -0500 Subject: [PATCH] add restrict to a few more places --- include/sudo_util.h | 2 +- lib/util/secure_path.c | 2 +- lib/util/uuid.c | 2 +- plugins/sudoers/toke_util.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/sudo_util.h b/include/sudo_util.h index 971aad22a9..3db6d914df 100644 --- a/include/sudo_util.h +++ b/include/sudo_util.h @@ -306,7 +306,7 @@ sudo_dso_public int sudo_secure_open_file_v1(const char *path, uid_t uid, gid_t #define sudo_secure_open_file(_a, _b, _c, _d, _e) sudo_secure_open_file_v1((_a), (_b), (_c), (_d), (_e)) sudo_dso_public int sudo_secure_open_dir_v1(const char *path, uid_t uid, gid_t gid, struct stat *sb, int *error); #define sudo_secure_open_dir(_a, _b, _c, _d, _e) sudo_secure_open_dir_v1((_a), (_b), (_c), (_d), (_e)) -sudo_dso_public int sudo_open_conf_path_v1(const char *path, char *name, size_t namesize, int (*fn)(const char *, int)); +sudo_dso_public int sudo_open_conf_path_v1(const char *restrict path, char *restrict name, size_t namesize, int (*fn)(const char *, int)); #define sudo_open_conf_path(_a, _b, _c, _d) sudo_open_conf_path_v1((_a), (_b), (_c), (_d)) /* setgroups.c */ diff --git a/lib/util/secure_path.c b/lib/util/secure_path.c index 57a8119d45..aaa95ababb 100644 --- a/lib/util/secure_path.c +++ b/lib/util/secure_path.c @@ -165,7 +165,7 @@ sudo_secure_open_dir_v1(const char *path, uid_t uid, gid_t gid, * Sets name based on the last file it tried to open, even on error. */ int -sudo_open_conf_path_v1(const char *path, char *name, size_t namesize, +sudo_open_conf_path_v1(const char *restrict path, char *restrict name, size_t namesize, int (*fn)(const char *, int)) { const char *cp, *ep, *path_end; diff --git a/lib/util/uuid.c b/lib/util/uuid.c index f082ee082f..b65bbcb2ff 100644 --- a/lib/util/uuid.c +++ b/lib/util/uuid.c @@ -100,7 +100,7 @@ sudo_uuid_to_string_v1(const unsigned char uuid[restrict static 16], char * rest * Returns 0 on success, -1 if str is not a valid uuid. */ int -sudo_uuid_from_string_v1(const char *str, unsigned char uuid[static 16]) +sudo_uuid_from_string_v1(const char *str, unsigned char uuid[restrict static 16]) { unsigned int i = 0, j = 0; int ch; diff --git a/plugins/sudoers/toke_util.c b/plugins/sudoers/toke_util.c index bb7e8e0a2a..92b0df9724 100644 --- a/plugins/sudoers/toke_util.c +++ b/plugins/sudoers/toke_util.c @@ -40,7 +40,7 @@ static size_t arg_size = 0; * Requires that dst have at least len + 1 bytes free. */ static void -copy_string(char *dst, const char *src, size_t len) +copy_string(char * restrict dst, const char * restrict src, size_t len) { const char *end = src + len; debug_decl(copy_string, SUDOERS_DEBUG_PARSER);