mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-28 20:42:49 +00:00
criu: Make use strlcpy() to copy into allocated strings
strncpy() with n == strlen(src) won't put NULL-terminator in dst. Signed-off-by: Dmitry Safonov <dima@arista.com>
This commit is contained in:
parent
0f438ceeed
commit
72ff290708
1 changed files with 3 additions and 2 deletions
|
|
@ -75,6 +75,7 @@
|
|||
#include "sk-queue.h"
|
||||
#include "sigframe.h"
|
||||
#include "fdstore.h"
|
||||
#include "string.h"
|
||||
|
||||
#include "parasite-syscall.h"
|
||||
#include "files-reg.h"
|
||||
|
|
@ -3142,7 +3143,7 @@ rst_prep_creds_args(CredsEntry *ce, unsigned long *prev_pos)
|
|||
|
||||
args = rst_mem_remap_ptr(this_pos, RM_PRIVATE);
|
||||
args->lsm_profile = lsm_profile;
|
||||
strncpy(args->lsm_profile, rendered, lsm_profile_len);
|
||||
strlcpy(args->lsm_profile, rendered, lsm_profile_len + 1);
|
||||
xfree(rendered);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -3176,7 +3177,7 @@ rst_prep_creds_args(CredsEntry *ce, unsigned long *prev_pos)
|
|||
|
||||
args = rst_mem_remap_ptr(this_pos, RM_PRIVATE);
|
||||
args->lsm_sockcreate = lsm_sockcreate;
|
||||
strncpy(args->lsm_sockcreate, rendered, lsm_sockcreate_len);
|
||||
strlcpy(args->lsm_sockcreate, rendered, lsm_sockcreate_len + 1);
|
||||
xfree(rendered);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue