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(terabox): panic due to slice out of range #7499

Merged
merged 1 commit into from
Nov 16, 2024

Conversation

Jason-Fly
Copy link
Contributor

修复问题

#7487 中第1个问题:如果TeroboxCookie失效或填写错误,会在driver Init阶段panic

问题原因

https://github.com/AlistGo/alist/blob/0a46979c519885465e586da009b70422382c84ac/drivers/terabox/util.go#L90C3-L90C61

  1. Terobox Init进行登录时,如果当前ip与注册时的区域不符时,接口会返回errno=6然后进入这段逻辑,并根据header中返回的url prefix设置正确的url
  2. 但是,在更换prefix后重新请求时,如果Cookie不合法,也会返回errno=6,导致再次进入到这段逻辑中,由于这时header中没有Url-Domain-Prefix了,导致访问nil的切片造成panic

修复方案

增加非空判断,如果Cookie不合法则会抛出错误

@xhofe xhofe merged commit c3c5843 into AlistGo:main Nov 16, 2024
3 checks passed
xrgzs pushed a commit to xrgzs/alist that referenced this pull request Nov 16, 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.

2 participants