Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14657 > unrolled thread
| Started by | L A Walsh <bash@tlinx.org> |
|---|---|
| First post | 2018-09-25 05:15 -0700 |
| Last post | 2018-09-25 05:15 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: bash sockets: printf \x0a does TCP fragmentation L A Walsh <bash@tlinx.org> - 2018-09-25 05:15 -0700
| From | L A Walsh <bash@tlinx.org> |
|---|---|
| Date | 2018-09-25 05:15 -0700 |
| Subject | Re: bash sockets: printf \x0a does TCP fragmentation |
| Message-ID | <mailman.1292.1537877720.1284.bug-bash@gnu.org> |
On 9/24/2018 6:05 AM, Greg Wooledge wrote:
> 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
>
----
This brings to mind a consideration:
As %s says to print a string of data (presumably not
including a NUL byte), then what happens if "$data" is
a paragraph of text with embedded newlines. In that case,
it sounds like bash might break apart the single printf
output into smaller packets rather than transmitting the
entirety of "$data" in 1 write (presuming it is less than
the maximum data size for a network packet).
Also, if you want to flush the data out at the end, it seems
"%s\n" would be required to force out the last line of text if
it wasn't nl terminated.
> That is utterly horrifying.
>
---
Hmmm....I didn't realize how sensitive some sensibilities were...
:-)
Back to top | Article view | gnu.bash.bug
csiph-web