summaryrefslogtreecommitdiff
path: root/src/geo.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-07-06 18:39:25 +0200
committerantirez <antirez@gmail.com>2015-07-06 18:39:25 +0200
commit5e04189887ed9100577374cede428c62d23fabe4 (patch)
tree977724fae62ccf1326d12bc79e55e546601a4807 /src/geo.c
parent5254c2d3c350f4edbb2f5dfde506fcb1ec58ee66 (diff)
downloadredis-5e04189887ed9100577374cede428c62d23fabe4.tar.gz
Geo: validate long,lat passed by user via API
Diffstat (limited to 'src/geo.c')
-rw-r--r--src/geo.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/geo.c b/src/geo.c
index b56711123..90c59c807 100644
--- a/src/geo.c
+++ b/src/geo.c
@@ -98,6 +98,12 @@ int extractLongLatOrReply(redisClient *c, robj **argv,
REDIS_OK) {
return REDIS_ERR;
}
+ if (xy[0] < GEO_LONG_MIN || xy[0] > GEO_LONG_MAX ||
+ xy[1] < GEO_LAT_MIN || xy[1] > GEO_LAT_MAX) {
+ addReplySds(c, sdscatprintf(sdsempty(),
+ "-ERR invalid longitude,latitude pair %f,%f\r\n",xy[0],xy[1]));
+ return REDIS_ERR;
+ }
}
return REDIS_OK;
}