From 4c7e1e892a9f2d46ad6802e2310c30f66501bb3a Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 30 Sep 2017 16:26:16 +0200 Subject: [PATCH] Added patch to fix size of allocated ranges block. --- patches/patchinstall.sh | 18 ++++++++++++- ...e-of-allocated-ranges-block-Coverity.patch | 25 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 patches/server-create_ranges/0001-server-Fix-size-of-allocated-ranges-block-Coverity.patch diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index d22ebd53..91380d23 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "2ae0574d8eac19db501a79ce2597f2fe30a770bd" + echo "4a2505a93a699baf9668af2cdfdd7b662d13c976" } # Show version information @@ -349,6 +349,7 @@ patch_enable_all () enable_server_Signal_Thread="$1" enable_server_Stored_ACLs="$1" enable_server_Timestamp_Compat="$1" + enable_server_create_ranges="$1" enable_server_device_manager_destroy="$1" enable_server_free_async_queue="$1" enable_server_send_hardware_message="$1" @@ -1327,6 +1328,9 @@ patch_enable () server-Timestamp_Compat) enable_server_Timestamp_Compat="$2" ;; + server-create_ranges) + enable_server_create_ranges="$2" + ;; server-device_manager_destroy) enable_server_device_manager_destroy="$2" ;; @@ -7845,6 +7849,18 @@ if test "$enable_server_Timestamp_Compat" -eq 1; then ) >> "$patchlist" fi +# Patchset server-create_ranges +# | +# | Modified files: +# | * server/mapping.c +# | +if test "$enable_server_create_ranges" -eq 1; then + patch_apply server-create_ranges/0001-server-Fix-size-of-allocated-ranges-block-Coverity.patch + ( + printf '%s\n' '+ { "Sebastian Lackner", "server: Fix size of allocated ranges block (Coverity).", 1 },'; + ) >> "$patchlist" +fi + # Patchset server-device_manager_destroy # | # | Modified files: diff --git a/patches/server-create_ranges/0001-server-Fix-size-of-allocated-ranges-block-Coverity.patch b/patches/server-create_ranges/0001-server-Fix-size-of-allocated-ranges-block-Coverity.patch new file mode 100644 index 00000000..e1450e72 --- /dev/null +++ b/patches/server-create_ranges/0001-server-Fix-size-of-allocated-ranges-block-Coverity.patch @@ -0,0 +1,25 @@ +From 9a80755fe1afdfabb07a53fb58f858cc0ab3634c Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sat, 30 Sep 2017 16:25:21 +0200 +Subject: server: Fix size of allocated ranges block (Coverity). + +--- + server/mapping.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/server/mapping.c b/server/mapping.c +index 8459c316559..22cd5c2064d 100644 +--- a/server/mapping.c ++++ b/server/mapping.c +@@ -682,7 +682,7 @@ static struct ranges *create_ranges(void) + if (!ranges) return NULL; + ranges->count = 0; + ranges->max = 8; +- if (!(ranges->ranges = mem_alloc( ranges->max * sizeof(ranges->ranges) ))) ++ if (!(ranges->ranges = mem_alloc( ranges->max * sizeof(*ranges->ranges) ))) + { + release_object( ranges ); + return NULL; +-- +2.14.1 +