-
Notifications
You must be signed in to change notification settings - Fork 190
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
Unix domain #306
Merged
Merged
Unix domain #306
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4e257c5
a test case for unix domain.
kazu-yamamoto adc9f8b
fixing addr from accept.
kazu-yamamoto 93076eb
pokeSockAddr should always fill sockaddr for safety.
kazu-yamamoto 0cd928b
just using pokeArray thanks to nulls.
kazu-yamamoto 3ee89f3
refactoring.
kazu-yamamoto e877e1b
explaining the magic number 128.
kazu-yamamoto c8042c7
checking length of SockAddrUnix.
kazu-yamamoto 8771875
removing unix socket file just in case.
kazu-yamamoto 831fac6
using peekCAString instead of peekCString.
kazu-yamamoto c3e2e2e
using sockaddrStorageLen for sizeOfSockAddr SockAddrUnix.
kazu-yamamoto 1f3806f
Fix unix-domain bind() failure with longer than standard sockaddr len…
hs-viktor d0b11fb
using NULL intead of 0.
kazu-yamamoto b80dbeb
rescuing Windows.
kazu-yamamoto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,6 +97,7 @@ test-suite spec | |
build-depends: | ||
base < 5, | ||
bytestring, | ||
directory, | ||
HUnit, | ||
network, | ||
hspec | ||
|
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might not be safe when
path
is unexpectedly long. We now havesizeOfSockAddr
for unix-domain sockets as a constantsizeof(sockaddr_un)
, and it seems possible that trying to use a longer path will corrupt memory?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this with a short program that calls
allocaBytes 128
and thenpokeArray p
with an array of> 128
C chars. The compiler and run-time did not object, and dutifully dumped core when the array was large enough. So here, we need to fail ifSockAddrUnix path
contains apath
that is too long (which is a bit shorter than 128 bytes, since we have to account for thesun_family
structure member. It may be unwise to assume that it is the standard 2 bytes, so we could either compute the overhead explicitly, or just cap the size at120
(again as a named constant, properly commented at the top of the file).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, throw an error.