Geo: validate long,lat passed by user via API

This commit is contained in:
antirez
2015-07-06 18:39:25 +02:00
parent 5254c2d3c3
commit 5e04189887
3 changed files with 25 additions and 9 deletions

View File

@ -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;
}