[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#235730: Another patch fixes segfault if volume header is corrupted



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Another patch fixes segfault if volume header is corrupted
- --
Gianluigi Tiesi <sherpya@netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFARUIi3UE5cRfnO04RAjaUAJ4vriLRyH0wfBe31Ues5+nj5KJgdwCgt5U9
KJql7p1GleYXJ52YbaajIkc=
=fbCk
-----END PGP SIGNATURE-----
--- taper-7.0pre-1.orig/tapeio.c	Sat May 18 20:34:27 2002
+++ taper-7.0pre-0sherpya1/tapeio.c	Wed Mar  3 03:00:32 2004
@@ -436,15 +436,17 @@
 	}
 	*t = *((struct tape_header *) (read_buffer+read_offset));
 	tape_header_endianize2mach(t);
-	if (log_level > 2) {
-	    sprintf(s, "Read in tape header %llx %llu %lld", t->magic, t->archive_id, t->tape_number);
-	    write_log(s);
-	}
 	read_offset += sizeof(struct tape_header);
 	if ((t->magic == TAPER_MAGIC_NUMBER) || 
 	    (t->magic == TAPER_4_MAGIC_NUMBER) ||
 	    (t->magic == TAPER_64_MAGIC)) 
-	  break;				 /* found magics - must be OK */
+	{
+	    if (log_level > 2) {
+	       sprintf(s, "Read in tape header %llx %llu %lld", t->magic, t->archive_id, t->tape_number);
+	       write_log(s);
+	    }
+	    break;				 /* found magics - must be OK */
+	}
 	if (tape_type == TAPE_TYPE_ZFTAPE) {	 /* zftape sometimes misses first read so try again */
 	    if (!is_regfile(dv) && !done_it) {	 /* only if using tape drive */
 		mt.mt_op = MTREW;		 /* try reading more than one segment  */
@@ -473,8 +475,6 @@
 	else					 /* not zftape */
 	  break;
     }
-    sprintf(s, "tape_header: m:%llX, id:%llX, #%lld, %s\n", t->magic, t->archive_id, t->tape_number, t->archive_title);
-	if (log_level > 2) write_log(s);
     return 0;
 }
 

Reply to: