Skip to content

Instantly share code, notes, and snippets.

@sgolemon
Created April 18, 2017 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgolemon/51f329655a94523546f081bf9c9afd31 to your computer and use it in GitHub Desktop.
Save sgolemon/51f329655a94523546f081bf9c9afd31 to your computer and use it in GitHub Desktop.
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c
index 3ff6478..cd4bce0 100644
--- a/main/streams/xp_socket.c
+++ b/main/streams/xp_socket.c
@@ -581,7 +581,7 @@ static inline char *parse_ip_address_ex(const char *str, size_t str_len, int *po
return NULL;
}
*portno = strtol(p + 2, &e, 10);
- if (e && *e) {
+ if (e && *e && (*e != '/')) {
if (get_err) {
*err = strpprintf(0, "Failed to parse address \"%s\"", str);
}
@@ -600,7 +600,7 @@ static inline char *parse_ip_address_ex(const char *str, size_t str_len, int *po
if (colon) {
char *e = NULL;
*portno = strtol(colon + 1, &e, 10);
- if (!e || !*e) {
+ if (!e || !*e || (*e == '/')) {
return estrndup(str, colon - str);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment