Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Error 500 on login / fix read file on empty files #1717

Merged
merged 1 commit into from
May 7, 2024

Conversation

baumerdev
Copy link
Contributor

Login fails if files in /var/log/pwfail/ exist but are empty. I got this error in my /var/log/phplog

[07-May-2024 20:28:25 Europe/Berlin] PHP Fatal error:  Uncaught ValueError: fread(): Argument #2 ($length) must be greater than 0 in /usr/local/emhttp/plugins/dynamix/include/.login.php:23
Stack trace:
#0 /usr/local/emhttp/plugins/dynamix/include/.login.php(23): fread(Resource id #22, 0)
#1 /usr/local/emhttp/plugins/dynamix/include/.login.php(64): readFromFile('/var/log/pwfail...')
#2 /usr/local/emhttp/plugins/dynamix/include/.login.php(198): cleanupFails('/var/log/pwfail...', 1715106505)
#3 /usr/local/emhttp/login.php(37): include('/usr/local/emht...')
#4 {main}
  thrown in /usr/local/emhttp/plugins/dynamix/include/.login.php on line 23

I added an additional check to only open and read the file if the size is greater than 0.

Copy link
Member

@ljm42 ljm42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great fix, appreciate it!

ljm42 added a commit that referenced this pull request May 7, 2024
@limetech limetech merged commit 7fdb5cb into unraid:master May 7, 2024
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.

None yet

3 participants