X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=5M29ZabyfzPlDg5LLHh7INjj6j9AHg2f+M9viMsOgZo=; b=Eh0rdX5fTwp8t4vydftknb6QG9T8wC8iAaVYJAdJaIVOziLE2O/5FbnUyrPoem2QYF kbBeM76u/L1bKDlt1xgkcQUvdCK4wL7sLK1SNBUmIqKdGZZj+s/w57ZKIaOAuaLPBcne egzYeDd7uzIaCuBvNykOWbuvyOrshVdVqI2+MQvwD11vAk+Q2oFtLn6fTTBlTewURXnH 3a/cmVoWrzjt4YiAc/Rb15eM9RqL1IL4rWUStsm41gDvn3ze1zox8hEoTjtJRC+kVr8Z 3V/0kKrQmyQfJWA58uqq4baVMWeLqxOaQnFM/p7+CoQnS6ZVvexHizu5GrKdmcB/jnN7 z9Mw== MIME-Version: 1.0 X-Received: by 10.202.88.215 with SMTP id m206mr22390984oib.47.1442405424868; Wed, 16 Sep 2015 05:10:24 -0700 (PDT) Date: Wed, 16 Sep 2015 15:10:24 +0300 Message-ID: Subject: dlopen.c: make sure filename is not NULL and not empty From: "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com]" To: djgpp Content-Type: text/plain; charset=UTF-8 Reply-To: djgpp AT delorie DOT com 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)) {