public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Carlos O'Donell <carlos@redhat.com>
To: Andreas Schwab <schwab@suse.de>
Cc: GNU C Library <libc-alpha@sourceware.org>,
	"Dmitry V. Levin" <ldv@altlinux.org>,
	Florian Weimer <fweimer@redhat.com>
Subject: Re: [PATCH] Improve DST handling (Bug 23102, Bug 21942, Bug 18018, Bug, 23259, CVE-2011-0536 ).
Date: Tue, 12 Jun 2018 12:46:00 -0000	[thread overview]
Message-ID: <fd1aee06-54a9-717e-4925-3eef02bb53f4@redhat.com> (raw)
In-Reply-To: <mvmsh5sfolh.fsf@suse.de>

On 06/12/2018 03:31 AM, Andreas Schwab wrote:
> On Jun 11 2018, Carlos O'Donell <carlos@redhat.com> wrote:
> 
>> By validating it against the abstract definition of the ELF gABI spec 
>> for a DST name it prevents any future caller from accidentally straying
>> outside of that contract without having to make two changes: (1) change 
>> the comparison DST and (2) change what we accept in is_dst().
> 
> Why would we add any use of is_dst with an invalid DST?  That doesn't
> make sense.

An invalid DST would be a mistake. The point is to catch mistakes by
enforcing the rules for valid DSTs.

>> Also I find the code ends up being simpler.
> 
> I don't agree.  It is overly complex for no reason.

There is a reason. You don't think the reason has any value though,
and that's different. That's also OK.

I'll post a v6 with the validation removed, I appreciate your point
of view. I'll work with Florian to get strncmp usage in place.

Would you be OK with something like this?

  /* Is a ${...} input sequence?  */
  if (input[0] == '{')
    {
      is_curly = true;
      ++input;
    }

  /* Check for matching name, following closing curly brace (if
     required), or trailing characters which are part of an
     identifier.  */
  size_t rlen = strlen (ref);
  if (strncmp (input, ref, rlen) != 0
      || (is_curly && input[rlen] != '}')
      || ((input[rlen] >= 'A' && input[rlen] <= 'Z')
          || (input[rlen] >= 'a' && input[rlen] <= 'z')
          || (input[rlen] >= '0' && input[rlen] <= '9')
          || (input[rlen] == '_')))
    return 0;
  
  if (is_curly)
    /* Count the two curly braces.  */
    return ilen + 2;
  else
    return ilen;

Cheers,
Carlos.g

  reply	other threads:[~2018-06-12 12:46 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06  5:03 Carlos O'Donell
2018-06-06 14:01 ` Florian Weimer
2018-06-06 14:55   ` Carlos O'Donell
2018-06-06 14:17 ` Florian Weimer
2018-06-06 15:59   ` Carlos O'Donell
2018-06-06 15:47 ` Andreas Schwab
2018-06-06 16:01   ` Carlos O'Donell
2018-06-06 16:10 ` Carlos O'Donell
2018-06-06 16:31   ` Andreas Schwab
2018-06-06 17:10     ` Carlos O'Donell
2018-06-06 17:28       ` Florian Weimer
2018-06-06 18:49         ` Carlos O'Donell
2018-06-06 18:56           ` Florian Weimer
2018-06-06 20:04             ` Carlos O'Donell
2018-06-07  6:49       ` Andreas Schwab
2018-06-08  2:08         ` Carlos O'Donell
2018-06-11  8:04           ` Andreas Schwab
2018-06-12  3:08             ` Carlos O'Donell
2018-06-12  7:31               ` Andreas Schwab
2018-06-12 12:46                 ` Carlos O'Donell [this message]
2018-06-12 13:02                   ` Andreas Schwab
2018-06-12 13:03                     ` Carlos O'Donell
2018-06-06 20:19   ` Carlos O'Donell
2018-06-07 11:38     ` Florian Weimer
2018-06-08  2:14       ` Carlos O'Donell
2018-06-07 12:16     ` Florian Weimer
2018-06-08  4:15       ` Carlos O'Donell
2018-06-08  5:21         ` Florian Weimer
2018-06-08  5:46           ` Carlos O'Donell
2018-06-08  5:50             ` Carlos O'Donell
2018-06-07 12:43     ` Florian Weimer
2018-06-08  5:37       ` Carlos O'Donell
2018-06-08  5:45     ` [PATCH v4] " Carlos O'Donell
2018-06-08  5:51       ` Florian Weimer
2018-06-08  6:03         ` Carlos O'Donell
2018-06-08  6:25           ` Florian Weimer
2018-06-11  2:55             ` Carlos O'Donell
2018-06-11  7:28               ` Florian Weimer
2018-06-11 14:44                 ` Carlos O'Donell
2018-06-12  3:46       ` Carlos O'Donell
2018-06-12 13:08         ` [PATCH v6] " Carlos O'Donell
2018-06-12 13:20           ` Andreas Schwab
2018-06-12 13:23             ` Andreas Schwab
2018-06-12 14:10               ` Carlos O'Donell
2018-06-12 14:34                 ` Andreas Schwab
2018-06-12 14:31           ` Florian Weimer
2018-06-12 14:36             ` Carlos O'Donell

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=fd1aee06-54a9-717e-4925-3eef02bb53f4@redhat.com \
    --to=carlos@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=ldv@altlinux.org \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).