mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "Jₑₙₛ Gustedt" <jens.gustedt@inria.fr>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com
Subject: Re: [musl] changes for scanf in C23
Date: Mon, 29 May 2023 21:10:59 +0200	[thread overview]
Message-ID: <20230529211059.19111ab9@inria.fr> (raw)
In-Reply-To: <20230529155929.GV4163@brightrain.aerifal.cx>

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

Rich,

on Mon, 29 May 2023 11:59:29 -0400 you (Rich Felker <dalias@libc.org>)
wrote:

> On Mon, May 29, 2023 at 12:32:02PM +0200, Jₑₙₛ Gustedt wrote:
> > Hi,
> > we already discussed this but it doesn't seem that we have come to a
> > conclusion.
> > 
> > The problem is that for C23 semantics of several string to integer
> > conversion functions change: a 'b' or 'B' that previously was the
> > stop condition for integer parsing may become part of the integer
> > string. This concerns all `scanf` and `strto` derivatives.
> > 
> > This is probably not a problem for most applications that parse
> > strings to integers, but it could be in some situations, and in
> > particular it could open vulnerabilities. E.g network addresses that
> > are read with base `0` (musl does this at some point to allow to
> > have decimal or hex strings) could be open to attacks, once people
> > start using binary encodings for integers more often. Another
> > scenario where this could lead to harm is automatically produced
> > output that is automatically scanned, and where nobody previously
> > took care of proper word boundaries.
> > 
> > My current idea is to have two sets of these functions, one that has
> > the old semantics and one that has the new.  
> 
> This was rejected already in the first proposal (thread here):
> 
> Message-ID: <20230503000045.GU4163@brightrain.aerifal.cx>
> https://www.openwall.com/lists/musl/2023/05/03/1
> 
>     "There are not going to be different versions of scanf/strto*
>     because there's just no way to do that in a conforming way..."

Alright, saves me a lot of trouble. I'll forward all complaints by
users to you ;-)

Jₑₙₛ

-- 
:: ICube :::::::::::::::::::::::::::::: deputy director ::
:: Université de Strasbourg :::::::::::::::::::::: ICPS ::
:: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus ::
:: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536 ::
:: https://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2023-05-29 19:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-29 10:32 Jₑₙₛ Gustedt
2023-05-29 15:59 ` Rich Felker
2023-05-29 19:10   ` Jₑₙₛ Gustedt [this message]
2023-08-26 20:58     ` Fangrui Song

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=20230529211059.19111ab9@inria.fr \
    --to=jens.gustedt@inria.fr \
    --cc=dalias@libc.org \
    --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).