mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 10:41:26 +00:00
Change memcpy() to strncpy() because the source name string is not guaranteed
to exist as valid addressable memory beyond the NULL byte. Signed-off-by: David Butterfield <dab21774@gmail.com> with small addition to force set last byte NULL git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7109 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -415,7 +415,8 @@ int target_create(const char *name, struct target **out_target)
|
||||
}
|
||||
|
||||
memset(target, 0, sizeof(*target));
|
||||
memcpy(target->name, name, sizeof(target->name) - 1);
|
||||
strncpy(target->name, name, sizeof(target->name) - 1);
|
||||
target->name[sizeof(target->name)-1] = '\0';
|
||||
|
||||
params_set_defaults(target->target_params, target_keys);
|
||||
params_set_defaults(target->session_params, session_keys);
|
||||
|
||||
Reference in New Issue
Block a user