X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/9311d2b527b0bb3e72e61b143718e6def51491e6..05e06e154332cf107d30092dddb94b6b35967ce5:/src/db.c diff --git a/src/db.c b/src/db.c index e65106a5..e78b0d53 100644 --- a/src/db.c +++ b/src/db.c @@ -226,7 +226,11 @@ void existsCommand(redisClient *c) { } void selectCommand(redisClient *c) { - int id = atoi(c->argv[1]->ptr); + long id; + + if (getLongFromObjectOrReply(c, c->argv[1], &id, + "invalid DB index") != REDIS_OK) + return; if (selectDb(c,id) == REDIS_ERR) { addReplyError(c,"invalid DB index");