This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


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

Re: [patch] dlfcn/dlerror.c: dlerror(): Check for result->errstring being NULL


>>>>> Ben Collins writes:

 > The problem appeared when dlerror() was called before anything was
 > dlopen()'d ("int main() {dlerror();}"), which caused a segfault. The
 > problem was that last_result is unitialized at this point, and that case
 > isn't checked for before trying to strcmp result->errstring. This patch
 > fixes that case, and returns NULL, just as if there were no errors
 > (which there aren't).

 > 2001-01-01  Ben Collins  <bcollins@debian.org>

 > 	* dlfcn/dlerror.c: dlerror(): Check for result->errstring being
 > 	  NULL.

Let's first add something to add to our testsuite,

Andreas

2001-01-02  Andreas Jaeger  <aj@suse.de>

	* dlfcn/errmsg1.c (main): Call dlerror initially.
	Reported by Ben Collins <bcollins@debian.org>.

============================================================
Index: dlfcn/errmsg1.c
--- dlfcn/errmsg1.c	2000/12/28 03:58:00	1.1
+++ dlfcn/errmsg1.c	2001/01/02 06:03:20
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -26,6 +26,10 @@
 {
   void *h;
   const char *s;
+
+  /* Test that dlerror works initially.  */
+  s = dlerror ();
+  puts (s);
 
   h = dlopen ("errmsg1mod.so", RTLD_NOW);
   if (h != NULL)

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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