Skip to content

Commit 604b8e7

Browse files
azeemshaikh38jarkkojs
authored andcommitted
KEYS: Replace all non-returning strlcpy with strscpy
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated [1]. In an effort to remove strlcpy() completely [2], replace strlcpy() here with strscpy(). No return values were used, so direct replacement is safe. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [2] KSPP#89 Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
1 parent 44e69ea commit 604b8e7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

security/keys/request_key_auth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ struct key *request_key_auth_new(struct key *target, const char *op,
178178
if (!rka->callout_info)
179179
goto error_free_rka;
180180
rka->callout_len = callout_len;
181-
strlcpy(rka->op, op, sizeof(rka->op));
181+
strscpy(rka->op, op, sizeof(rka->op));
182182

183183
/* see if the calling process is already servicing the key request of
184184
* another process */

0 commit comments

Comments
 (0)