[riot-notifications] [RIOT-OS/RIOT] sys/shell: handle correctly long strings that overflow buffer (#11054)
notifications at github.com
Fri Feb 22 05:03:02 CET 2019
### Contribution description
On very long input lines to the shell that are bigger than the shell buffer passed to the `shell_run` function (usually `SHELL_DEFAULT_BUFSIZE`) the shell process will exit.
My expected behaviour is that it will just discard or ignore the very long string and keep running. This was the original behaviour indeed but #10105 changed it as the return code of `getchar` for `EOF` is -1 which is the same value that was being used to signal a too long string. The solution is therefore trivially to use another error value for this case (I did a define for the sake of readability and possible future use).
The PR also adds an automated test for this case.
### Testing procedure
Execute a shell and send a very long string. In the old version shell will just exit, in the new chars will be discarded.
Or run the new version of automated tests under `tests/shell`
You can view, comment on, or merge this pull request online at:
-- Commit Summary --
* sys/shell: handle correctly long strings that overflow buffer
-- File Changes --
M sys/shell/shell.c (4)
M tests/shell/tests/01-run.py (8)
-- Patch Links --
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications