summaryrefslogtreecommitdiff
path: root/src/plugins/mapcache.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2020-01-12 16:16:02 +0100
committerGitHub <noreply@github.com>2020-01-12 16:16:02 +0100
commitd88ba2f882c92753a9093432daa55f06db8dec93 (patch)
tree0fe3cc037e846f9db765f271ec082d54b7cba11d /src/plugins/mapcache.c
parentbf99547843038bc15dc1948748d969950e866465 (diff)
parentad7a25af13277c280fb4a7cbf134fe5d01de186d (diff)
downloadhercules-d88ba2f882c92753a9093432daa55f06db8dec93.tar.gz
hercules-d88ba2f882c92753a9093432daa55f06db8dec93.tar.bz2
hercules-d88ba2f882c92753a9093432daa55f06db8dec93.tar.xz
hercules-d88ba2f882c92753a9093432daa55f06db8dec93.zip
Merge pull request #2599 from 4144/updatepackets
Update packets up to 2020-01-08
Diffstat (limited to 'src/plugins/mapcache.c')
-rw-r--r--src/plugins/mapcache.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/plugins/mapcache.c b/src/plugins/mapcache.c
index 5e44492f6..208f39abb 100644
--- a/src/plugins/mapcache.c
+++ b/src/plugins/mapcache.c
@@ -281,7 +281,28 @@ bool mapcache_cache_map(const char *mapname)
if (rsw == NULL) {
water_height = NO_WATER;
} else {
- water_height = (int)GetFloat(rsw + 166);
+ if (memcmp(rsw, "GRSW", 4) != 0) {
+ ShowError("mapcache_cache_map: file %s is not in rsw format\n", filepath);
+ aFree(rsw);
+ return false;
+ }
+ int major_version = rsw[4];
+ int minor_version = rsw[5];
+ if (major_version > 2 || (major_version == 2 && minor_version > 2)) {
+ ShowError("mapcache_cache_map: Unsupported version %d.%d for rsw file %s\n", major_version, minor_version, filepath);
+ aFree(rsw);
+ return false;
+ }
+ if (major_version < 1 || (major_version == 1 && minor_version <= 4)) {
+ ShowError("mapcache_cache_map: Unsupported version %d.%d for rsw file %s\n", major_version, minor_version, filepath);
+ aFree(rsw);
+ return false;
+ }
+ int offset = 166;
+ if (major_version == 2 && minor_version >= 2) {
+ offset = 167;
+ }
+ water_height = (int)GetFloat(rsw + offset);
aFree(rsw);
}