src/test_file_io.c : Use snprintf instead of strncpy in test program.

This commit is contained in:
Erik de Castro Lopo 2009-02-23 02:59:57 +11:00
parent cf815c36c9
commit 6c214803ab
2 changed files with 6 additions and 3 deletions

View File

@ -43,6 +43,9 @@
* regtest/*.c
Bunch of fixes.
* src/test_file_io.c
Use snprintf instead of strncpy in test program.
2009-02-21 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/sd2.c

View File

@ -68,7 +68,7 @@ file_open_test (const char *filename)
exit (1) ;
} ;
strncpy (psf->filename, filename, sizeof (psf->filename)) ;
snprintf (psf->filename, sizeof (psf->filename), "%s", filename) ;
/* Test that open for read fails if the file doesn't exist. */
error = psf_fopen (psf, psf->filename, SFM_READ) ;
@ -121,7 +121,7 @@ file_read_write_test (const char *filename)
memset (&sf_data, 0, sizeof (sf_data)) ;
psf = &sf_data ;
strncpy (psf->filename, filename, sizeof (psf->filename)) ;
snprintf (psf->filename, sizeof (psf->filename), "%s", filename) ;
/* Test file open in write mode. */
psf->mode = SFM_WRITE ;
@ -277,7 +277,7 @@ file_truncate_test (const char *filename)
memset (buffer, 0xEE, sizeof (buffer)) ;
psf = &sf_data ;
strncpy (psf->filename, filename, sizeof (psf->filename)) ;
snprintf (psf->filename, sizeof (psf->filename), "%s", filename) ;
/*
** Open the file write mode, write 0xEE data and then extend the file