]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
country: Terminate buffer when reading from database
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 13 Jul 2020 10:47:30 +0000 (10:47 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 13 Jul 2020 10:47:30 +0000 (10:47 +0000)
Compilers on ARM do not seem to initialise the buffer.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/country.c

index d6ddf508636fb5d69a080c8814a9530133465358..2ba93e6ef7d5c225d032b8b307ad76942659b0e0 100644 (file)
@@ -125,6 +125,9 @@ int loc_country_new_from_database_v1(struct loc_ctx* ctx, struct loc_stringpool*
        // Read country code
        loc_country_code_copy(buffer, dbobj->code);
 
+       // Terminate buffer
+       buffer[2] = '\0';
+
        // Create a new country object
        int r = loc_country_new(ctx, country, buffer);
        if (r)