NetBSD-Bugs archive

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

Re: bin/51815 ([PATCH] tests/lib/libc/string/t_str{chr,len}: don't leak dlopen'ed handle)



The following reply was made to PR bin/51815; it has been noted by GNATS.

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: gnats-admin%netbsd.org@localhost,
 netbsd-bugs%netbsd.org@localhost
Subject: Re: bin/51815 ([PATCH] tests/lib/libc/string/t_str{chr,len}: don't
 leak dlopen'ed handle)
Date: Fri, 13 Jan 2017 17:57:14 -0800

 --Apple-Mail=_008FB936-DF2A-4CD9-BDBB-FE1C75A95B8F
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=utf-8
 
 Hi!
 	I=E2=80=99m resending the t_strlen portion of the diff, just in =
 case it was lost before, since it hasn=E2=80=99t been applied to NetBSD =
 yet.
 Thanks!
 -Ngie
 
 --Apple-Mail=_008FB936-DF2A-4CD9-BDBB-FE1C75A95B8F
 Content-Disposition: attachment;
 	filename=t_strlen-dont-leak-the-dlopen_ed-handle.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_strlen-dont-leak-the-dlopen_ed-handle.patch"
 Content-Transfer-Encoding: 7bit
 
 ? obj
 ? string
 ? t_strchr-and-t_strlen-dont-leak-the-dlopen_ed-handle.patch
 ? t_strerror-add-missing-stdio-h-header.patch
 ? t_strlen-dont-leak-the-dlopen_ed-handle.patch
 Index: t_strlen.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/string/t_strlen.c,v
 retrieving revision 1.5
 diff -u -r1.5 t_strlen.c
 --- t_strlen.c	14 Jul 2011 07:33:20 -0000	1.5
 +++ t_strlen.c	11 Jan 2017 07:30:45 -0000
 @@ -40,6 +40,7 @@
  
  ATF_TC_BODY(strlen_basic, tc)
  {
 +	void *dl_handle;
  	/* try to trick the compiler */
  	size_t (*strlen_fn)(const char *);
  
 @@ -107,7 +108,8 @@
  	 * During testing it is useful have the rest of the program
  	 * use a known good version!
  	 */
 -	strlen_fn = dlsym(dlopen(NULL, RTLD_LAZY), "test_strlen");
 +	dl_handle = dlopen(NULL, RTLD_LAZY);
 +	strlen_fn = dlsym(dl_handle, "test_strlen");
  	if (!strlen_fn)
  		strlen_fn = strlen;
  
 @@ -134,6 +136,7 @@
  			}
  		}
  	}
 +	(void)dlclose(dl_handle);
  }
  
  ATF_TC(strlen_huge);
 
 --Apple-Mail=_008FB936-DF2A-4CD9-BDBB-FE1C75A95B8F--
 



Home | Main Index | Thread Index | Old Index