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


Groups > gnu.bash.bug > #14652

Re: bash sockets: printf \x0a does TCP fragmentation

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: bash sockets: printf \x0a does TCP fragmentation
Date 2018-09-24 09:05 -0400
Message-ID <mailman.1224.1537794758.1284.bug-bash@gnu.org> (permalink)
References <c6de6616-dda0-570d-de56-419e7676be8a@cbii-hh.de> <20180921231101307758654@bob.proulx.com> <714e1ba0-0052-2f2b-676d-778f2b7129c1@testssl.sh>

Show all headers | View raw


On Sat, Sep 22, 2018 at 11:50:17AM +0200, dirk+bash@testssl.sh wrote:
> On 9/22/18 7:30 AM, Bob Proulx wrote:
> > dirk+bash@testssl.sh wrote:
> >> printf -- "$data" >&5 2>/dev/null
> > 
> > What happens if $data contains % format strings?  What happens if the
> > format contains a sequence such as \c?  This looks problematic.  This
> > is not a safe programming proctice.

Looking ONLY at this one line, there is an obvious bug, which Bob has
pointed out.  It should be

printf %s "$data" >&5 2>/dev/null

> I doubt you can judge on this by just looking at a single line
> of code -- the project has > 18k LoC in bash.

That is utterly horrifying.

I have no comments on the buffering issues.  Those have already been
covered.

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


Thread

Re: bash sockets: printf \x0a does TCP fragmentation Greg Wooledge <wooledg@eeg.ccf.org> - 2018-09-24 09:05 -0400

csiph-web