Skip to content

sys/shell: handle correctly long strings that overflow buffer#11054

Closed
fedepell wants to merge 1 commit intoRIOT-OS:masterfrom
fedepell:shell_ovf
Closed

sys/shell: handle correctly long strings that overflow buffer#11054
fedepell wants to merge 1 commit intoRIOT-OS:masterfrom
fedepell:shell_ovf

Conversation

@fedepell
Copy link
Contributor

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

@PeterKietzmann PeterKietzmann added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: tools Area: Supplementary tools labels Feb 22, 2019
@jcarrano
Copy link
Contributor

This is a duplicate of #10635, which has been sitting idly for over two months.

@jcarrano jcarrano added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) State: duplicate State: The issue/PR is a duplicate of another issue/PR and removed Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: tools Area: Supplementary tools labels Feb 28, 2019
@fedepell
Copy link
Contributor Author

fedepell commented Mar 3, 2019

Sorry didn't see the other PR. closing!

@fedepell fedepell closed this Mar 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

State: duplicate State: The issue/PR is a duplicate of another issue/PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants