[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().
This commit is contained in:
John Bowler 2012-08-09 16:42:42 -05:00 committed by Glenn Randers-Pehrson
parent 0a9f8eb272
commit 5f5977e708
3 changed files with 14 additions and 2 deletions

View File

@ -410,6 +410,9 @@ Version 1.6.0beta27 [August 9, 2012]
declared even though the functions are never actually defined. This declared even though the functions are never actually defined. This
change provides a dummy definition so that the declarations work, yet any change provides a dummy definition so that the declarations work, yet any
implementation will fail to compile because of an incomplete type. 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 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -4161,6 +4161,9 @@ Version 1.6.0beta27 [August 9, 2012]
declared even though the functions are never actually defined. This declared even though the functions are never actually defined. This
change provides a dummy definition so that the declarations work, yet any change provides a dummy definition so that the declarations work, yet any
implementation will fail to compile because of an incomplete type. 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 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -1050,7 +1050,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
tIME_string[png_sizeof(tIME_string) - 1] = '\0'; tIME_string[png_sizeof(tIME_string) - 1] = '\0';
else else
strcpy(tIME_string, "*** invalid time ***"); {
strncpy(tIME_string, "*** invalid time ***", sizeof tIME_string);
tIME_string[(sizeof tIME_string)-1] = '\0';
}
tIME_chunk_present++; tIME_chunk_present++;
#endif /* PNG_TIME_RFC1123_SUPPORTED */ #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'; tIME_string[png_sizeof(tIME_string) - 1] = '\0';
else else
strcpy(tIME_string, "*** invalid time ***"); {
strncpy(tIME_string, "*** invalid time ***", sizeof tIME_string);
tIME_string[(sizeof tIME_string)-1] = '\0';
}
tIME_chunk_present++; tIME_chunk_present++;
#endif /* PNG_TIME_RFC1123_SUPPORTED */ #endif /* PNG_TIME_RFC1123_SUPPORTED */