Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16176

Re: %q with truncating size loses safeness of %q

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: %q with truncating size loses safeness of %q
Date 2020-04-19 15:36 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.716.1587325009.3066.bug-bash@gnu.org> (permalink)
References <CAOj-5WCqxqh=Gcda9k6y4orQaQYXPgsOgNEOVN1AdZQrkCVbtg@mail.gmail.com> <4bacf2f0-9802-67d3-f30b-80e37d058a4a@case.edu> <CAOj-5WAM4c38uJ4kWb-=_4qx_2umkHYVyWOGhPAac-ASNZqw4Q@mail.gmail.com> <695b7e4c-14b1-e625-831d-c1b053d573ad@case.edu>

Show all headers | View raw


On 4/17/20 4:38 PM, Sam Liddicott wrote:
> So is it to be "fixed" in the documentation with a warning that
> truncating-size specifiers for %q may nullify the safety benefits for which
> it is used?

Probably something more general, along the lines of the POSIX language for
the %b directive:

"Bytes from the converted string shall be written until the end of the
string or the number of bytes indicated by the precision specification is
reached. If the precision is omitted, it shall be taken to be infinite, so
all bytes up to the end of the converted string shall be written."

The %b, %()T, and %q (and %s) directives all behave the same way: generate
the argument and print it according to the supplied fieldwidth and
precision.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: %q with truncating size loses safeness of %q Chet Ramey <chet.ramey@case.edu> - 2020-04-19 15:36 -0400

csiph-web