diff options
Diffstat (limited to 'target/s390x/arch_dump.c')
-rw-r--r-- | target/s390x/arch_dump.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/target/s390x/arch_dump.c b/target/s390x/arch_dump.c index 50fa0ae..cc13308 100644 --- a/target/s390x/arch_dump.c +++ b/target/s390x/arch_dump.c @@ -212,11 +212,13 @@ static int s390x_write_elf64_notes(const char *note_name, int note_size; int ret = -1; + assert(strlen(note_name) < sizeof(note.name)); + for (nf = funcs; nf->note_contents_func; nf++) { memset(¬e, 0, sizeof(note)); note.hdr.n_namesz = cpu_to_be32(strlen(note_name) + 1); note.hdr.n_descsz = cpu_to_be32(nf->contents_size); - strncpy(note.name, note_name, sizeof(note.name)); + g_strlcpy(note.name, note_name, sizeof(note.name)); (*nf->note_contents_func)(¬e, cpu, id); note_size = sizeof(note) - sizeof(note.contents) + nf->contents_size; |