From abb74a4ff90cd3ff771034ced2bf05a963ceb660 Mon Sep 17 00:00:00 2001 From: leo-xia-jing Date: Sun, 4 Dec 2016 16:22:17 +0800 Subject: [PATCH] Update geohash.c --- geohash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geohash.c b/geohash.c index 27cd9f6..01055db 100644 --- a/geohash.c +++ b/geohash.c @@ -314,7 +314,7 @@ get_neighbor(char *hash, int direction) char **border = is_odd ? odd_borders : even_borders; char **neighbor = is_odd ? odd_neighbors : even_neighbors; - char *base = emalloc(sizeof(char) * 1); + char *base = emalloc(sizeof(char) * (hash_length + 1)); base[0] = '\0'; strncat(base, hash, hash_length - 1);