From 69f3cc46ab55311d4389408fcba5ec8f37b423f6 Mon Sep 17 00:00:00 2001 From: Trammell Hudson Date: Tue, 7 Jan 2020 19:01:59 +0100 Subject: [PATCH 1/2] libksba: fix qsort handler to sort the string table in a reproducible way Signed-off-by: Trammell Hudson --- patches/libkbsa-1.3.5.patch | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 patches/libkbsa-1.3.5.patch diff --git a/patches/libkbsa-1.3.5.patch b/patches/libkbsa-1.3.5.patch new file mode 100644 index 00000000..594083d5 --- /dev/null +++ b/patches/libkbsa-1.3.5.patch @@ -0,0 +1,20 @@ +--- clean/libksba-1.3.5/src/asn1-gentables.c 2016-08-22 11:38:21.000000000 +0200 ++++ libksba-1.3.5/src/asn1-gentables.c 2020-01-07 18:56:03.658790390 +0100 +@@ -112,7 +112,16 @@ + const struct name_list_s **a = (const struct name_list_s **)aptr; + const struct name_list_s **b = (const struct name_list_s **)bptr; + +- return strlen ((*a)->name) < strlen ((*b)->name); ++ const size_t len_a = strlen((*a)->name); ++ const size_t len_b = strlen((*b)->name); ++ ++ if (len_a == len_b) ++ return strcmp((*a)->name, (*b)->name); ++ else ++ if (len_a < len_b) ++ return -1; ++ else ++ return +1; + } + + static void From 6c93a5e85407aa1199fd205d63212e0a7263f5d2 Mon Sep 17 00:00:00 2001 From: Trammell hudson Date: Wed, 8 Jan 2020 10:01:21 +0100 Subject: [PATCH 2/2] libksba: fix name of patch file Signed-off-by: Trammell hudson --- patches/libkbsa-1.3.5.patch | 20 -------------------- patches/libksba-1.3.5.patch | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 20 deletions(-) delete mode 100644 patches/libkbsa-1.3.5.patch create mode 100644 patches/libksba-1.3.5.patch diff --git a/patches/libkbsa-1.3.5.patch b/patches/libkbsa-1.3.5.patch deleted file mode 100644 index 594083d5..00000000 --- a/patches/libkbsa-1.3.5.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- clean/libksba-1.3.5/src/asn1-gentables.c 2016-08-22 11:38:21.000000000 +0200 -+++ libksba-1.3.5/src/asn1-gentables.c 2020-01-07 18:56:03.658790390 +0100 -@@ -112,7 +112,16 @@ - const struct name_list_s **a = (const struct name_list_s **)aptr; - const struct name_list_s **b = (const struct name_list_s **)bptr; - -- return strlen ((*a)->name) < strlen ((*b)->name); -+ const size_t len_a = strlen((*a)->name); -+ const size_t len_b = strlen((*b)->name); -+ -+ if (len_a == len_b) -+ return strcmp((*a)->name, (*b)->name); -+ else -+ if (len_a < len_b) -+ return -1; -+ else -+ return +1; - } - - static void diff --git a/patches/libksba-1.3.5.patch b/patches/libksba-1.3.5.patch new file mode 100644 index 00000000..13fa7be4 --- /dev/null +++ b/patches/libksba-1.3.5.patch @@ -0,0 +1,23 @@ +--- clean/libksba-1.3.5/src/asn1-gentables.c 2016-08-22 11:38:21.000000000 +0200 ++++ libksba-1.3.5/src/asn1-gentables.c 2020-01-08 10:00:27.297737650 +0100 +@@ -109,10 +109,17 @@ + static int + cmp_string (const void *aptr, const void *bptr) + { +- const struct name_list_s **a = (const struct name_list_s **)aptr; +- const struct name_list_s **b = (const struct name_list_s **)bptr; ++ const char *a = (*(const struct name_list_s **)aptr)->name; ++ const char *b = (*(const struct name_list_s **)bptr)->name; + +- return strlen ((*a)->name) < strlen ((*b)->name); ++ const size_t len_a = strlen(a); ++ const size_t len_b = strlen(b); ++ ++ if (len_a < len_b) ++ return -1; ++ if (len_a > len_b) ++ return +1; ++ return strcmp(a, b); + } + + static void