This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch for dl-cache.c



Jakub found a bug in my version of ldconfig, which is also in glibc's
dl-cache.  I'm appending a patch for dl-cache.c.

The bug is that the final NUL in CACHEMAGIC is part of the magic - but
the data structure doesn't reserve space for it (this worked due to
alignment).

Andreas

1999-11-24  Andreas Jaeger  <aj@suse.de>

	* sysdeps/generic/dl-cache.c: The final NUL is part of magic, add
	it to structure and check for it.

============================================================
Index: sysdeps/generic/dl-cache.c
--- sysdeps/generic/dl-cache.c	1999/06/09 11:41:57	1.19
+++ sysdeps/generic/dl-cache.c	1999/11/24 14:38:11
@@ -36,7 +36,7 @@
 
 struct cache_file
   {
-    char magic[sizeof CACHEMAGIC - 1];
+    char magic[sizeof CACHEMAGIC];
     unsigned int nlibs;
     struct
       {
@@ -118,7 +118,7 @@
       void *file = _dl_sysdep_read_whole_file (LD_SO_CACHE, &cachesize,
 					       PROT_READ);
       if (file && cachesize > sizeof *cache &&
-	  !memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1))
+	  !memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC))
 	/* Looks ok.  */
 	cache = file;
       else

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]