From 5f5977e708f84647123efbdc153199d88b77b65c Mon Sep 17 00:00:00 2001 From: John Bowler Date: Thu, 9 Aug 2012 16:42:42 -0500 Subject: [PATCH] [libpng16] Re-eliminated the use of strcpy() in pngtest.c. An unncessary use of strcpy() was accidentally re-introduced in libpng16; this change replaces it with strncpy(). --- ANNOUNCE | 3 +++ CHANGES | 3 +++ pngtest.c | 10 ++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 5e837e062..c073b2e2b 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -410,6 +410,9 @@ Version 1.6.0beta27 [August 9, 2012] declared even though the functions are never actually defined. This change provides a dummy definition so that the declarations work, yet any implementation will fail to compile because of an incomplete type. + Re-eliminated the use of strcpy() in pngtest.c. An unncessary use of + strcpy() was accidentally re-introduced in libpng16; this change replaces + it with strncpy(). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 967c389ef..d86ee33ed 100644 --- a/CHANGES +++ b/CHANGES @@ -4161,6 +4161,9 @@ Version 1.6.0beta27 [August 9, 2012] declared even though the functions are never actually defined. This change provides a dummy definition so that the declarations work, yet any implementation will fail to compile because of an incomplete type. + Re-eliminated the use of strcpy() in pngtest.c. An unncessary use of + strcpy() was accidentally re-introduced in libpng16; this change replaces + it with strncpy(). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngtest.c b/pngtest.c index e1d55339c..41d49524c 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1050,7 +1050,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) tIME_string[png_sizeof(tIME_string) - 1] = '\0'; else - strcpy(tIME_string, "*** invalid time ***"); + { + strncpy(tIME_string, "*** invalid time ***", sizeof tIME_string); + tIME_string[(sizeof tIME_string)-1] = '\0'; + } tIME_chunk_present++; #endif /* PNG_TIME_RFC1123_SUPPORTED */ @@ -1256,7 +1259,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) tIME_string[png_sizeof(tIME_string) - 1] = '\0'; else - strcpy(tIME_string, "*** invalid time ***"); + { + strncpy(tIME_string, "*** invalid time ***", sizeof tIME_string); + tIME_string[(sizeof tIME_string)-1] = '\0'; + } tIME_chunk_present++; #endif /* PNG_TIME_RFC1123_SUPPORTED */