svn commit: r337065 - head/stand/libsa

Toomas Soome tsoome at FreeBSD.org
Thu Aug 2 06:22:11 UTC 2018


Author: tsoome
Date: Thu Aug  2 06:22:10 2018
New Revision: 337065
URL: https://svnweb.freebsd.org/changeset/base/337065

Log:
  libsa: dereferencing type-punned pointer in cd9660
  
  The warning is given by gcc build, but it is good to fix anyhow.
  use bcopy instead of direct assignment.

Modified:
  head/stand/libsa/cd9660.c
  head/stand/libsa/cd9660read.c

Modified: head/stand/libsa/cd9660.c
==============================================================================
--- head/stand/libsa/cd9660.c	Thu Aug  2 03:13:59 2018	(r337064)
+++ head/stand/libsa/cd9660.c	Thu Aug  2 06:22:10 2018	(r337065)
@@ -304,7 +304,7 @@ cd9660_open(const char *path, struct open_file *f)
 	if (isonum_723(vd->logical_block_size) != ISO_DEFAULT_BLOCK_SIZE)
 		goto out;
 
-	rec = *(struct iso_directory_record *) vd->root_directory_record;
+	bcopy(vd->root_directory_record, &rec, sizeof(rec));
 	if (*path == '/') path++; /* eat leading '/' */
 
 	first = 1;

Modified: head/stand/libsa/cd9660read.c
==============================================================================
--- head/stand/libsa/cd9660read.c	Thu Aug  2 03:13:59 2018	(r337064)
+++ head/stand/libsa/cd9660read.c	Thu Aug  2 06:22:10 2018	(r337065)
@@ -241,7 +241,7 @@ cd9660_lookup(const char *path)
 			break;
 	}
 
-	rec = *(struct iso_directory_record *) vd->root_directory_record;
+	bcopy(vd->root_directory_record, &rec, sizeof(rec));
 	if (*path == '/') path++; /* eat leading '/' */
 
 	first = 1;


More information about the svn-src-all mailing list