aboutsummaryrefslogtreecommitdiff
path: root/src/connect.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-12-28 00:24:47 +0100
committerAndreas Schneider <asn@cynapses.org>2010-12-28 00:24:47 +0100
commit438083542d31c3e4d208b3b8f3d2e0e6db0ecc6b (patch)
treee36dfce17ed5d8565e02402c0a12a57a9e68fdf3 /src/connect.c
parent4fa2e4dde159a62a0d15bc800a7480f29fd964b1 (diff)
downloadlibssh-438083542d31c3e4d208b3b8f3d2e0e6db0ecc6b.tar.gz
libssh-438083542d31c3e4d208b3b8f3d2e0e6db0ecc6b.tar.xz
libssh-438083542d31c3e4d208b3b8f3d2e0e6db0ecc6b.zip
connect: Use a better IP regex.
Diffstat (limited to 'src/connect.c')
-rw-r--r--src/connect.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/connect.c b/src/connect.c
index 1dc9bf0b..92421a6d 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -122,6 +122,8 @@ void ssh_sock_set_blocking(socket_t sock) {
#endif /* _WIN32 */
#ifdef HAVE_REGCOMP
+#define IPEXPR "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}"
+
static regex_t *ip_regex = NULL;
/** @internal
@@ -134,7 +136,7 @@ int ssh_regex_init(){
int err;
regex_t *regex=malloc(sizeof (regex_t));
ZERO_STRUCTP(regex);
- err=regcomp(regex,"^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$",REG_EXTENDED | REG_NOSUB);
+ err = regcomp(regex, IPEXPR, REG_EXTENDED | REG_NOSUB);
if(err != 0){
char buffer[128];
regerror(err,regex,buffer,sizeof(buffer));