diff --git a/dump.c b/dump.c index e56b7cfc25c292835ebbaa0026da32a570e844d0..ac4505ec80ff85af413499a35d8c13cab50d5476 100644 --- a/dump.c +++ b/dump.c @@ -716,8 +716,8 @@ static int write_start_flat_header(int fd) int ret = 0; memset(&mh, 0, sizeof(mh)); - strncpy(mh.signature, MAKEDUMPFILE_SIGNATURE, - strlen(MAKEDUMPFILE_SIGNATURE)); + memcpy(mh.signature, MAKEDUMPFILE_SIGNATURE, + MIN(sizeof mh.signature, sizeof MAKEDUMPFILE_SIGNATURE)); mh.type = cpu_to_be64(TYPE_FLAT_HEADER); mh.version = cpu_to_be64(VERSION_FLAT_HEADER);