Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

audit: Replace deprecated strcpy() with strscpy()

strcpy() is deprecated; use strscpy() instead.

Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Paul Moore <paul@paul-moore.com>

authored by

Thorsten Blum and committed by
Paul Moore
d8c09d7b c5055d0c

+4 -2
+4 -2
kernel/audit_tree.c
··· 93 93 static struct audit_tree *alloc_tree(const char *s) 94 94 { 95 95 struct audit_tree *tree; 96 + size_t sz; 96 97 97 - tree = kmalloc(struct_size(tree, pathname, strlen(s) + 1), GFP_KERNEL); 98 + sz = strlen(s) + 1; 99 + tree = kmalloc(struct_size(tree, pathname, sz), GFP_KERNEL); 98 100 if (tree) { 99 101 refcount_set(&tree->count, 1); 100 102 tree->goner = 0; ··· 105 103 INIT_LIST_HEAD(&tree->list); 106 104 INIT_LIST_HEAD(&tree->same_root); 107 105 tree->root = NULL; 108 - strcpy(tree->pathname, s); 106 + strscpy(tree->pathname, s, sz); 109 107 } 110 108 return tree; 111 109 }