Skip to content

iprdbg will fall into an endless loop on stdin EOF#7

Open
Low-power wants to merge 1 commit intobjking1:masterfrom
Low-power:fix-iprdbg-eof-loop
Open

iprdbg will fall into an endless loop on stdin EOF#7
Low-power wants to merge 1 commit intobjking1:masterfrom
Low-power:fix-iprdbg-eof-loop

Conversation

@Low-power
Copy link

For example, when pressing ^D on an empty command prompt of iprdbg(8), it will fall into a loop, flooding stdout (usually a terminal) and log file (/var/log/iprdbg):

# iprdbg

ATTENTION: This utility is for adapter developers only! Use at your own risk!

Use "quit" to exit the program.

IPRDB(572A)> Invalid command �. Use "help" for a list of valid commands
IPRDB(572A)> Invalid command �. Use "help" for a list of valid commands
IPRDB(572A)> Invalid command �. Use "help" for a list of valid commands
IPRDB(572A)> Invalid command �. Use "help" for a list of valid commands
IPRDB(572A)> Invalid command �. Use "help" for a list of valid commands
IPRDB(572A)> Invalid command �. Use "help" for a list of valid commands
...

This commit fixes 2 bugs:

  • ipr_fgets incorrectly stores the EOF mark ((int)-1) into the output buffer (pointed by buf), resulted in that garble character in above output;
  • The main loop in main didn't handle the stdin EOF condition, resulted an endless loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant