Fix panic when receiving with --stdout and invalid secret#993
Merged
Conversation
Co-authored-by: schollz <6550035+schollz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix panic when receiving with invalid CROC_SECRET
Fix panic when receiving with --stdout and invalid secret
Oct 31, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When receiving with
--stdoutand an invalidCROC_SECRET, the program panics withindex out of range [0]instead of returning an error gracefully.Changes
FilesToTransfer[c.FilesToTransferCurrentNum]in stdout cleanup pathTestReceiverStdoutWithInvalidSecretto verify graceful error handlingDetails
The stdout cleanup code at line 1178 assumed
FilesToTransferwas populated, but when authentication fails early in the transfer, the array remains empty:With this fix, invalid secrets now return:
room (secure channel) not ready, maybe peer disconnectedWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
239.255.255.250croc.schollz.com./croc --version(dns block)/tmp/go-build2651178820/b001/croc.test -test.testlogfile=/tmp/go-build2651178820/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true(dns block)/tmp/go-build3825911463/b001/croc.test -test.testlogfile=/tmp/go-build3825911463/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true(dns block)croc6.schollz.com./croc --version(dns block)/tmp/go-build2651178820/b001/croc.test -test.testlogfile=/tmp/go-build2651178820/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true(dns block)/tmp/go-build3825911463/b001/croc.test -test.testlogfile=/tmp/go-build3825911463/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true(dns block)doesntexistok.com/tmp/go-build2651178820/b001/croc.test -test.testlogfile=/tmp/go-build2651178820/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true(dns block)/tmp/go-build227569924/b001/croc.test -test.testlogfile=/tmp/go-build227569924/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true(dns block)/tmp/go-build77411867/b001/croc.test -test.testlogfile=/tmp/go-build77411867/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true -test.run=TestReceiverStdoutWithInvalidSecret|TestCrocLocal|TestCrocError(dns block)example.com/tmp/go-build1733538028/b286/models.test -test.testlogfile=/tmp/go-build1733538028/b286/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true(dns block)ipv4.icanhazip.com/tmp/go-build1733538028/b292/utils.test -test.testlogfile=/tmp/go-build1733538028/b292/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true(dns block)/tmp/go-build3215944763/b001/utils.test -test.testlogfile=/tmp/go-build3215944763/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true(dns block)this-hostname-should-definitely-not-exist-98765/tmp/go-build1733538028/b286/models.test -test.testlogfile=/tmp/go-build1733538028/b286/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true(dns block)this-hostname-should-not-exist-12345/tmp/go-build1733538028/b286/models.test -test.testlogfile=/tmp/go-build1733538028/b286/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.