mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jean-Marc Pigeon <jmp@safe.ca>
To: musl@lists.openwall.com
Subject: Re: setenv if value=NULL, what say standard? Bug?
Date: Thu, 23 Apr 2015 08:58:50 -0400	[thread overview]
Message-ID: <5538EC8A.5080206@safe.ca> (raw)
In-Reply-To: <20150423101039.GC17573@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 2852 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello...

[..]
>> 
>> As reported, the crashing application is hwclock,
>> (util-linux-2.26), this a kind of code in the field for a very
>> very long time,
> 
> And it either crashes every time it's run (for a given
> configuration, at least) or doesn't. If it does you know during
> early testing rather than letting a bug slip through.
> 
>> so the library (glibc and old libc) used for linux over the years
>> defined an expected behavior to this "UB".
> 
> No, that was merely a bug in glibc, not a feature.

Hmmm... glibc-2.21, setenv.c explicitly check the value NULL
condition, so situation is checked, you could object about
the way program handle it, but it is not a bug (situation
expected and addressed).


> Crashing is inevitable on the vast majority of invalid programs. 
> setenv("TZ", (char *)0xdeadbeef, 1); will almost certainly crash,
> and if it doesn't it will likely do something worse.
Fully agreed, this is pure garbage, out of spec. library
will/must crash (protect the hardware).
> 
>> (:-} why bother to return an error, just crash for all problems
>> in open, close, write, etc. just bringing the crashing concept to
>> the extreme :-}).
> 

> 
> int foo(const char *fn) { char buf[2]; strcpy(buf, "hello world,
> and goodbye");

In perfect world, strcpy should crash on the spot not going further.
this is clearly "out of spec" (a far fetch to be UB).


> int fd = open(fn ? fn : buf, O_RDONLY); return fd < 0 ? -1 : fd; }



- -- 

A bientôt
===========================================================
Jean-Marc Pigeon                        E-Mail: jmp@safe.ca
SAFE Inc.                             Phone: (514) 493-4280
  Clement, 'a kiss solution' to get rid of SPAM (at last)
     Clement' Home base <"http://www.clement.safe.ca">
===========================================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJVOOyKAAoJEAtgwJ4bBQU5E4YP/1G+J2vij9VF34tfZycG3iHO
Gs6y2WYsvyVZK66WsnDOOoaBr5h6bJv8pga++6hu/DVPpbXfZpY1ysNKQ63hxP02
1fFA8h1UjDJ4BM/aXHGothjp2kIXVn5CzJKuf2KUrFiR59t9WJu4KDR6/MsbRXTx
MsnOS25x+UCo4yQExemTuANAofdrst5mDyXovBdEaEGuGiTZuZri9NvZ8BZGEd4Y
v8cX/+UyY3X7UrB1+AAXbMEDs+miibXIGBI6EPPme5sDeVTm3V4kmqgdPu3Q+D00
Mgq6D+uj7Y3Wg8yHfzlVw/wZBYh1KGJNjOXJhKjmBvquCa3SQADAWBPc109J1Iip
v6efkBy3b36uWT5xoRtX4Db8+jdUUiVLLj4zRBytgkLokK8imvLlIGa1oBIUYGN8
RzC7Ma0hgHl7Tqxa7awvOfoVgqTWxC6saLmzJ+N8hFy5yg6YJYr+yvLY8fLkRPQM
BdNu/YzwFb1gIKDyq+lPtCjvMZVHpfcZMYorcV22N2zyaW7UTqU7BqRLR2mY/ojh
Nf8mUZNEsfeSNNHANZa5gixXFfDIQ/8zkZbIbY3XItESjdJft0wBmLBk8t0IJ6nO
zexIcNM3NozIZotsL+L47cHoedrYSLp/v2HK5kJ/V638qRGKhxkz9IBbe1UMwOfV
0kG3h7pAHZ5iBchsiQ8G
=yBbf
-----END PGP SIGNATURE-----


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4242 bytes --]

  reply	other threads:[~2015-04-23 12:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23  0:08 Jean-Marc Pigeon
2015-04-23  0:35 ` Laurent Bercot
2015-04-23  1:26   ` Jean-Marc Pigeon
2015-04-23  2:15     ` Rich Felker
2015-04-23  4:24       ` Jean-Marc Pigeon
2015-04-23  5:08         ` Raphael Cohn
2015-04-23 12:29           ` Jean-Marc Pigeon
2015-04-23  9:23         ` Laurent Bercot
2015-04-23  9:52           ` Raphael Cohn
2015-04-23 10:47             ` Laurent Bercot
2015-04-23 10:10         ` Rich Felker
2015-04-23 12:58           ` Jean-Marc Pigeon [this message]
2015-04-23 13:22             ` Szabolcs Nagy
2015-04-23 13:58               ` Jean-Marc Pigeon
2015-04-23 14:26                 ` Szabolcs Nagy
2015-04-23  8:05       ` Jens Gustedt
2015-04-23  9:55         ` Rich Felker
2015-04-24  4:11       ` Isaac Dunham
2015-04-23  5:52   ` Isaac Dunham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5538EC8A.5080206@safe.ca \
    --to=jmp@safe.ca \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).