[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bash-bug
Subject:    Re: bash sockets: printf \x0a does TCP fragmentation
From:       Greg Wooledge <wooledg () eeg ! ccf ! org>
Date:       2018-09-24 13:05:33
Message-ID: 20180924130533.4ufaxypoelta6f7n () eeg ! ccf ! org
[Download RAW message or body]

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.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic