[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] Replace unsafe string functions with their
From: |
Peter Bex |
Subject: |
Re: [Chicken-hackers] [PATCH] Replace unsafe string functions with their safer counterparts |
Date: |
Thu, 6 Feb 2014 10:04:08 +0100 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, Feb 06, 2014 at 02:21:07AM +0000, Mario Domenech Goulart wrote:
> On Wed, 05 Feb 2014 23:56:11 +0000 Mario Domenech Goulart <address@hidden>
> wrote:
> > The environment variable tests in posix-tests.scm caught the issue.
> > Here's an example:
> >
> > #;1> (use posix)
> > ; loading c:/local/chicken-master-mingw/lib/chicken/7/posix.import.so
> > ; ...
> > ; loading library posix ...
> > #;2> (setenv "FOO" "bar")
> > #;3> (get-environment-variable "FOO")
> > "x\x01=b\x03"
> >
> > Reverting 8efbbc50d050d28c34ea0c5a58d0de92ec9f918a makes tests pass
> > again. Tested on cygwin, mingw (Windows XP 32bit).
>
> I forgot to mention that on cygwin I had to define HAVE_STRLCAT and
> HAVE_STRLCPY in Makefile.cygwin, otherwise I'd get errors like
> http://paste.call-cc.org/paste?id=87b50bb84351693193183e7c58f2293b6cd52148
>
> After defining HAVE_STRLCAT and STRLCPY and rebuilding chicken, I get
> the environment variables issue.
I've added that. Here's a patch that should fix the setenv issue.
I haven't tested it yet, so please give it a try.
The second patch should prevent these collision problems if for some
reason a library happens to define strlcat() even if HAVE_STRLCAT is
not defined. This can not only happen if HAVE_STRLCAT is erroneously
omitted on platforms that simply have it, but also on Linux for example,
when using libbsd and including bsd/string.h
Cheers,
Peter
--
http://www.more-magic.net
0001-Prevent-problems-when-the-host-system-does-provide-s.patch
Description: Text document
0002-Fix-strlcat-usage-in-setenv-use-the-start-of-the-str.patch
Description: Text document