]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/libloc-0.9.3-country-terminate-buffer-when-reading-from-database.patch
libloc: Add upstream patch to fix a buffer issue.
[ipfire-2.x.git] / src / patches / libloc-0.9.3-country-terminate-buffer-when-reading-from-database.patch
1 commit 61d3516bbfce6b4e6393825329c07b1e2a88d47d
2 Author: Michael Tremer <michael.tremer@ipfire.org>
3 Date: Mon Jul 13 10:47:30 2020 +0000
4
5 country: Terminate buffer when reading from database
6
7 Compilers on ARM do not seem to initialise the buffer.
8
9 Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
10
11 diff --git a/src/country.c b/src/country.c
12 index d6ddf50..2ba93e6 100644
13 --- a/src/country.c
14 +++ b/src/country.c
15 @@ -125,6 +125,9 @@ int loc_country_new_from_database_v1(struct loc_ctx* ctx, struct loc_stringpool*
16 // Read country code
17 loc_country_code_copy(buffer, dbobj->code);
18
19 + // Terminate buffer
20 + buffer[2] = '\0';
21 +
22 // Create a new country object
23 int r = loc_country_new(ctx, country, buffer);
24 if (r)