]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
libloc: Add upstream patch to fix a buffer issue.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 19 Jul 2020 18:21:41 +0000 (20:21 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Tue, 21 Jul 2020 11:09:54 +0000 (11:09 +0000)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
lfs/libloc
src/patches/libloc-0.9.3-country-terminate-buffer-when-reading-from-database.patch [new file with mode: 0644]

index 5cf3e0819c770304f5eeddd6a2442ed9ff5d88f9..4f392baca6ede865d4ddd6ae3d2562ce218004bb 100644 (file)
@@ -78,6 +78,9 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar xvf $(DIR_DL)/$(DL_FILE)
 
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar xvf $(DIR_DL)/$(DL_FILE)
 
+       # Apply upstream patches
+       cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/libloc-0.9.3-country-terminate-buffer-when-reading-from-database.patch
+
        # Add patch for i585 to disable the stack protector.
        cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/libloc-0.9.3-perl-no-stack-protector.patch
 
        # Add patch for i585 to disable the stack protector.
        cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/libloc-0.9.3-perl-no-stack-protector.patch
 
diff --git a/src/patches/libloc-0.9.3-country-terminate-buffer-when-reading-from-database.patch b/src/patches/libloc-0.9.3-country-terminate-buffer-when-reading-from-database.patch
new file mode 100644 (file)
index 0000000..0ad9229
--- /dev/null
@@ -0,0 +1,24 @@
+commit 61d3516bbfce6b4e6393825329c07b1e2a88d47d
+Author: Michael Tremer <michael.tremer@ipfire.org>
+Date:   Mon Jul 13 10:47:30 2020 +0000
+
+    country: Terminate buffer when reading from database
+    
+    Compilers on ARM do not seem to initialise the buffer.
+    
+    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
+
+diff --git a/src/country.c b/src/country.c
+index d6ddf50..2ba93e6 100644
+--- a/src/country.c
++++ b/src/country.c
+@@ -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)