Limit maximum line length in interactive shells

Dear all,

it seems as if I sent around the wrong version of the patch. Please find
the correct version attached to this e-mail.

Kind regards,

> one of our testers found out that he could reliably reboot our
> erlang-based device by just sending tons of 'A' characters to an
> interactive shell.
>
> It appears that the I/O server of the interactive shell (in group.erl)
> is always reading a full line before doing any end-of-input processing,
> so that by sending bytes without a newline in between, it slowly eats up
> all available memory.
>
> The patch attached to this e-mail fixes that by introducing a new
> io:setopt() option in group.erl named 'max_length' that is used to check
> whether the current line length exceeds this maximum whenever the line
> is edited. If an overlong line is detected, max_length bytes are
> returned immediately (without the actual stop condition being fulfilled,
> though, allowing I/O clients to detect this situation).
>
> max_length is allowed to be an integer() > 0 or 'unlimited'. The default
> is 'unlimited' to have the old behaviour by default.
>
>
>
> Kind regards,
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@erlang.org
> http://erlang.org/mailman/listinfo/erlang-patches

--
Dr. Stefan Zegenhagen

arcutronix GmbH
Garbsener Landstr. 10
30419 Hannover
Germany

Tel:   +49 511 277-2734
Fax:   +49 511 277-2709
Email: stefan.zegenhagen@arcutronix.com
Web:   www.arcutronix.com

*Synchronize the Ethernet*

General Managers: Dipl. Ing. Juergen Schroeder, Dr. Josef Gfrerer -
Legal Form: GmbH, Registered office: Hannover, HRB 202442, Amtsgericht
Hannover; Ust-Id: DE257551767.

Please consider the environment before printing this message.

>From b8b904f4ca1e0b418f8e758c9aa5e43b6469c3b4 Mon Sep 17 00:00:00 2001
From: Stefan Zegenhagen <stefan.zegenhagen@arcutronix.com>
Date: Tue, 7 May 2013 14:14:50 +0200
Subject: [PATCH] limit line length in interactive shells

Since the I/O server in group.erl was always collecting full lines
before doing any further end-of-input processing, it was possible to
crash any erlang system by just sending tons of characters without any
newline to an interactive shell.

Fix that by allowing to specify a maximum input length. Whenever new
characters are received from the input device, check whether the new
input exceeds the maximum line length and if so, return the data that
was read so far (up to the maximum line length characters).
Merge branch 'dg/win_icon' into pu
Merge branch 'rc/break-out-asserts' into pu
Merge branch 'nm/mnesia_idx_insert_speedup' into pu
Merge branch 'tja/erl_pp_options' into pu
Merge branch 'nox/disambiguate-equal-binary' into pu
Merge branch 'hsv/add_init_to_lists' into pu
Merge branch 'nox/fix-silent-rules' into pu
Merge branch 'sla/odbc_in_non_standard_location' into pu
Merge branch 'avi/fix-os-cmd-win' into pu
Merge branch 'ao/fix_mnesia_block_table_exception' into pu
Merge branch 'sze/ssh_cli_handles' into pu
Merge branch 'sze/edlin_understand_keys' into pu
Merge branch 'epa/observer_state_view' into pu
Merge branch 'sze/limit_max_length_int_shell' into pu