Make sure length of header buffer can hold header plus strings.

This commit is contained in:
Erik de Castro Lopo 2006-01-10 08:54:06 +00:00
parent 32f0eb11d3
commit 7ec8e15eb3
2 changed files with 5 additions and 4 deletions

View File

@ -58,6 +58,7 @@
#define SF_TEXT_LEN (1024)
#define SF_SYSERR_LEN (256)
#define SF_MAX_STRINGS (16)
#define SF_STR_BUFFER_LEN (4096)
#define PSF_SEEK_ERROR ((sf_count_t) -1)
@ -217,7 +218,7 @@ typedef struct sf_private_tag
** sound files.
*/
STR_DATA strings [SF_MAX_STRINGS] ;
char str_storage [SF_BUFFER_LEN] ;
char str_storage [SF_STR_BUFFER_LEN] ;
char *str_end ;
int str_flags ;

View File

@ -85,9 +85,9 @@ psf_store_string (SF_PRIVATE *psf, int str_type, const char *str)
#if STRINGS_DEBUG
psf_log_printf (psf, "str_storage : %X\n", (int) psf->str_storage) ;
psf_log_printf (psf, "str_end : %X\n", (int) psf->str_end) ;
psf_log_printf (psf, "sizeof (storage) : %d\n", SIGNED_SIZEOF (psf->str_storage)) ;
psf_log_printf (psf, "str_storage : %X\n", (int) psf->str_storage) ;
psf_log_printf (psf, "str_end : %X\n", (int) psf->str_end) ;
psf_log_printf (psf, "sizeof (str_storage) : %d\n", SIGNED_SIZEOF (psf->str_storage)) ;
#endif
len_remaining = SIGNED_SIZEOF (psf->str_storage) - (psf->str_end - psf->str_storage) ;