From 6e197f37ef648b541ce499e65beb8e52a9c5dbf2 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 15 Oct 2019 13:30:05 +0000 Subject: [PATCH] country: Fix SEGV when accessing the string pool This was caused because I am too stupid to count to two. Signed-off-by: Michael Tremer --- src/country.c | 3 --- src/loc/country.h | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/country.c b/src/country.c index d075bd7..6e9bfaa 100644 --- a/src/country.c +++ b/src/country.c @@ -137,15 +137,12 @@ int loc_country_new_from_database_v0(struct loc_ctx* ctx, struct loc_stringpool* goto FAIL; // Set name -#if 0 - // XXX Reading from the stringpool makes test-country.c fail const char* name = loc_stringpool_get(pool, be32toh(dbobj->name)); if (name) { r = loc_country_set_name(*country, name); if (r) goto FAIL; } -#endif return 0; diff --git a/src/loc/country.h b/src/loc/country.h index b5fd944..8d4ab23 100644 --- a/src/loc/country.h +++ b/src/loc/country.h @@ -49,7 +49,7 @@ static inline void loc_country_copy_code(char* dst, const char* src) { } // Terminate the string - dst[3] = '\0'; + dst[2] = '\0'; } #endif -- 2.47.3