Made preparer_id more safe against oversize

This commit is contained in:
Thomas Schmitt 2008-02-14 18:24:34 +00:00
parent baa13e0b88
commit 53e662d9f1
2 changed files with 14 additions and 9 deletions

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.02.14.175623"
#define Xorriso_timestamP "2008.02.14.182351"

View File

@ -722,7 +722,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
{
int ret, media_space, img_sectors, padding= 0, profile= 0, relax= 0, i;
int major, minor, micro;
char profile_name[80], xorriso_id[128+1], *img_id;
char profile_name[80], xorriso_id[256], *img_id;
struct isoburn_imgen_opts *sopts= NULL;
struct burn_drive_info *dinfo, *source_dinfo;
struct burn_drive *drive, *source_drive;
@ -831,18 +831,23 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
sopts.fifo_size= xorriso->fs * 2048;
#endif /* NIX */
if(image!=NULL) {
if(image!=NULL &&
strlen(Xorriso_program_versioN)+strlen(Xorriso_timestamP)<80) {
sprintf(xorriso_id, "XORRISO-%s %s",
Xorriso_program_versioN, Xorriso_timestamP);
isoburn_version(&major, &minor, &micro);
sprintf(xorriso_id+strlen(xorriso_id),
", LIBISOBURN-%d.%d.%d", major, minor, micro);
if(strlen(xorriso_id)<80)
sprintf(xorriso_id+strlen(xorriso_id),
", LIBISOBURN-%d.%d.%d", major, minor, micro);
iso_lib_version(&major, &minor, &micro);
sprintf(xorriso_id+strlen(xorriso_id),
", LIBISOFS-%d.%d.%d", major, minor, micro);
if(strlen(xorriso_id)<80)
sprintf(xorriso_id+strlen(xorriso_id),
", LIBISOFS-%d.%d.%d", major, minor, micro);
burn_version(&major, &minor, &micro);
sprintf(xorriso_id+strlen(xorriso_id),
", LIBBURN-%d.%d.%d", major, minor, micro);
if(strlen(xorriso_id)<80)
sprintf(xorriso_id+strlen(xorriso_id),
", LIBBURN-%d.%d.%d", major, minor, micro);
xorriso_id[128]= 0;
img_id= (char *) iso_image_get_data_preparer_id(image);
if(img_id!=NULL) {
for(i= strlen(img_id)-1; i>=0 && img_id[i]==' '; i--);