Skip to content

Commit 85d08e9

Browse files
LumioseSilmillert
authored andcommitted
Restrict-qualify iolog_path_escapes like we do with check_iolog_path
Also add it to the function pointer definition to act as a hint to use restrict in the various copy functions.
1 parent 36cea6e commit 85d08e9

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

include/sudo_iolog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ struct iolog_file {
9494

9595
struct iolog_path_escape {
9696
const char *name;
97-
size_t (*copy_fn)(char *, size_t, void *);
97+
size_t (*copy_fn)(char * restrict, size_t, void * restrict );
9898
};
9999

100100
/* host_port.c */

plugins/sudoers/iolog_path_escapes.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ strlcpy_no_slash(char * restrict dst, const char * restrict src, size_t size)
6060
}
6161

6262
static size_t
63-
fill_seq(char *str, size_t strsize, void *v)
63+
fill_seq(char * restrict str, size_t strsize, void * restrict v)
6464
{
6565
#ifdef SUDOERS_NO_SEQ
6666
debug_decl(fill_seq, SUDOERS_DEBUG_UTIL);
@@ -86,15 +86,15 @@ fill_seq(char *str, size_t strsize, void *v)
8686
}
8787

8888
static size_t
89-
fill_user(char *str, size_t strsize, void *v)
89+
fill_user(char * restrict str, size_t strsize, void * restrict v)
9090
{
9191
struct sudoers_context *ctx = v;
9292
debug_decl(fill_user, SUDOERS_DEBUG_UTIL);
9393
debug_return_size_t(strlcpy_no_slash(str, ctx->user.name, strsize));
9494
}
9595

9696
static size_t
97-
fill_group(char *str, size_t strsize, void *v)
97+
fill_group(char * restrict str, size_t strsize, void * restrict v)
9898
{
9999
struct sudoers_context *ctx = v;
100100
struct group *grp;
@@ -111,15 +111,15 @@ fill_group(char *str, size_t strsize, void *v)
111111
}
112112

113113
static size_t
114-
fill_runas_user(char *str, size_t strsize, void *v)
114+
fill_runas_user(char * restrict str, size_t strsize, void * restrict v)
115115
{
116116
struct sudoers_context *ctx = v;
117117
debug_decl(fill_runas_user, SUDOERS_DEBUG_UTIL);
118118
debug_return_size_t(strlcpy_no_slash(str, ctx->runas.pw->pw_name, strsize));
119119
}
120120

121121
static size_t
122-
fill_runas_group(char *str, size_t strsize, void *v)
122+
fill_runas_group(char * restrict str, size_t strsize, void * restrict v)
123123
{
124124
struct sudoers_context *ctx = v;
125125
struct group *grp;
@@ -141,15 +141,15 @@ fill_runas_group(char *str, size_t strsize, void *v)
141141
}
142142

143143
static size_t
144-
fill_hostname(char *str, size_t strsize, void *v)
144+
fill_hostname(char * restrict str, size_t strsize, void * restrict v)
145145
{
146146
struct sudoers_context *ctx = v;
147147
debug_decl(fill_hostname, SUDOERS_DEBUG_UTIL);
148148
debug_return_size_t(strlcpy_no_slash(str, ctx->user.shost, strsize));
149149
}
150150

151151
static size_t
152-
fill_command(char *str, size_t strsize, void *v)
152+
fill_command(char * restrict str, size_t strsize, void * restrict v)
153153
{
154154
struct sudoers_context *ctx = v;
155155
debug_decl(fill_command, SUDOERS_DEBUG_UTIL);

0 commit comments

Comments
 (0)