bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash sockets: printf \x0a does TCP fragmentation


From: Greg Wooledge
Subject: Re: bash sockets: printf \x0a does TCP fragmentation
Date: Mon, 24 Sep 2018 09:05:33 -0400
User-agent: NeoMutt/20170113 (1.7.2)

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]