www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2015/09/16/13:30:05

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Received: by 10.107.150.66 with SMTP id y63mr28125432iod.11.1442423680272;
Wed, 16 Sep 2015 10:14:40 -0700 (PDT)
X-Received: by 10.182.116.165 with SMTP id jx5mr123549obb.27.1442423680249;
Wed, 16 Sep 2015 10:14:40 -0700 (PDT)
Newsgroups: comp.os.msdos.djgpp
Date: Wed, 16 Sep 2015 10:14:40 -0700 (PDT)
In-Reply-To: <CAA2C=vCi88BYHh-yRXvtx8az13Y9wymqkjs93UJHx=qaZRPOGQ@mail.gmail.com>
Complaints-To: groups-abuse AT google DOT com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=46.5.89.220; posting-account=OsAajgoAAADdKJnkJkmhzqP0jo6I_P_0
NNTP-Posting-Host: 46.5.89.220
References: <CAA2C=vCi88BYHh-yRXvtx8az13Y9wymqkjs93UJHx=qaZRPOGQ AT mail DOT gmail DOT com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cae6b037-4d08-4255-aa4f-d423a86a0d1c@googlegroups.com>
Subject: Re: dlopen.c: make sure filename is not NULL and not empty
From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
Injection-Date: Wed, 16 Sep 2015 17:14:40 +0000
Bytes: 2437
Lines: 32
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wednesday, September 16, 2015 at 2:39:19 PM UTC+2, Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com] wrote:
> If there are no objections, I want to apply the following
> patch to both HEAD and to v2_05_1.  dlopen(NULL,mode) is
> supported by glibc but not by djgpp, and such a call left
> unchecked will result in Bad Things (TM) to happen.
> 
> Index: dlopen.c
> ===================================================================
> RCS file: /cvs/djgpp/djgpp/src/libc/dxe/dlopen.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 dlopen.c
> --- dlopen.c	21 Aug 2015 18:10:28 -0000	1.9
> +++ dlopen.c	16 Sep 2015 12:02:07 -0000
> @@ -119,6 +119,11 @@ void *dlopen(const char *filename, int m
>    _dl_unresolved_count = 0;
>    errno = 0;
> 
> +  if (!filename || !*filename) {
> +    errno = EINVAL;
> +    return NULL;
> +  }
> +
>    /* Find the dynamic module along the LD_LIBRARY_PATH */
>    if (!ACCESS(filename))
>    {


Looks ok to me but my man page tells something like this:
"If filename is NULL, then the returned handle is for the  main  program."
What shall this imply for DJGPP?  Neitherless we should always test for NULL pointer.

Regards,
Juan M. Guerrero

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019