From 5e3828d57016830c189b14df12d4fa09c25f77af Mon Sep 17 00:00:00 2001 From: Breno Leitao Date: Jun 20 2018 18:56:33 +0000 Subject: harness: Fix strncpy argument Argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source, instead of the destination. Signed-off-by: Breno Leitao --- diff --git a/harness/cases/19.t b/harness/cases/19.t index 4989510..5c3e0d6 100644 --- a/harness/cases/19.t +++ b/harness/cases/19.t @@ -41,7 +41,7 @@ open_temp_file(void) int fd; char template[sizeof(TEMPLATE)]; - strncpy(template, TEMPLATE, sizeof(TEMPLATE)); + strncpy(template, TEMPLATE, sizeof(template)); fd = mkostemp(template, O_DIRECT); if (fd < 0) { perror("mkstemp"); diff --git a/harness/cases/21.t b/harness/cases/21.t index 441eaa8..4433fb2 100644 --- a/harness/cases/21.t +++ b/harness/cases/21.t @@ -43,7 +43,7 @@ open_temp_file() int fd; char temp_file[sizeof(TEMPLATE)]; - strncpy(temp_file, TEMPLATE, sizeof(TEMPLATE)); + strncpy(temp_file, TEMPLATE, sizeof(tempfile)); fd = mkstemp(temp_file); if (fd < 0) { perror("mkstemp");