Ver código fonte

ndb_redis: fix parsing of integer arguments from server connect string

Reported and patch contributed by Andrew Pogrebennyk
Jon Bonilla 14 anos atrás
pai
commit
e5a5344290
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      modules/ndb_redis/redis_client.c

+ 2 - 2
modules/ndb_redis/redis_client.c

@@ -71,10 +71,10 @@ int redisc_init(void)
 				addr = pit->body.s;
 				addr = pit->body.s;
 				addr[pit->body.len] = '\0';
 				addr[pit->body.len] = '\0';
 			} else if(pit->name.len==4 && strncmp(pit->name.s, "port", 4)==0) {
 			} else if(pit->name.len==4 && strncmp(pit->name.s, "port", 4)==0) {
-				if(!str2int(&pit->body, &port))
+				if(!str2int(&pit->body, &port) < 0)
 					port = 6379;
 					port = 6379;
 			} else if(pit->name.len==2 && strncmp(pit->name.s, "db", 2)==0) {
 			} else if(pit->name.len==2 && strncmp(pit->name.s, "db", 2)==0) {
-				if(!str2int(&pit->body, &db))
+				if(!str2int(&pit->body, &db) < 0)
 					db = 0;
 					db = 0;
 			}
 			}
 		}
 		}