summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/sock_any.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/sock_any.c b/common/sock_any.c
index f01933b..7a128f2 100644
--- a/common/sock_any.c
+++ b/common/sock_any.c
@@ -4,6 +4,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
+#include <string.h>
#include "sock_any.h"
@@ -183,11 +184,11 @@ int sock_any_pton(const char* addr, struct sockaddr_any* any, int defport)
t = NULL;
l = strlen(addr);
- if(l < 255 && isalpha(addr[0]))
+ if(l >= 255 || !isalpha(addr[0]))
break;
/* Some basic illegal character checks */
- if(strspn(addr, " /\\") != l)
+ if(strcspn(addr, " /\\") != l)
break;
strcpy(buf, addr);