From 53e662d9f138094306ee65ddd69234d567216530 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 14 Feb 2008 18:24:34 +0000 Subject: [PATCH] Made preparer_id more safe against oversize --- libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- libisoburn/trunk/xorriso/xorrisoburn.c | 21 ++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 9852072e..d7567536 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.02.14.175623" +#define Xorriso_timestamP "2008.02.14.182351" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.c b/libisoburn/trunk/xorriso/xorrisoburn.c index 45615bde..c38c80c2 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.c +++ b/libisoburn/trunk/xorriso/xorrisoburn.c @@ -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, µ); - 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, µ); - 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, µ); - 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--);