]> git.ipfire.org Git - ipfire-2.x.git/blame - 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
CommitLineData
99f8980d
SS
1commit 61d3516bbfce6b4e6393825329c07b1e2a88d47d
2Author: Michael Tremer <michael.tremer@ipfire.org>
3Date: 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
11diff --git a/src/country.c b/src/country.c
12index 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)