From bd89f2ce5c1cde06a762011b67987baa1ae9cb6b Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Fri, 14 Feb 2020 14:28:21 +0100 Subject: [PATCH] Fix build with gcc 10 --- nss-signtool-format.patch | 94 +++++++++++++++++++++++++++++++++++++++ nss.spec | 2 + 2 files changed, 96 insertions(+) create mode 100644 nss-signtool-format.patch diff --git a/nss-signtool-format.patch b/nss-signtool-format.patch new file mode 100644 index 0000000..f54e7f3 --- /dev/null +++ b/nss-signtool-format.patch @@ -0,0 +1,94 @@ +diff --git a/cmd/modutil/install.c b/cmd/modutil/install.c +--- a/cmd/modutil/install.c ++++ b/cmd/modutil/install.c +@@ -825,17 +825,20 @@ rm_dash_r(char *path) + + dir = PR_OpenDir(path); + if (!dir) { + return -1; + } + + /* Recursively delete all entries in the directory */ + while ((entry = PR_ReadDir(dir, PR_SKIP_BOTH)) != NULL) { +- sprintf(filename, "%s/%s", path, entry->name); ++ if (snprintf(filename, sizeof(filename), "%s/%s", path, entry->name) >= sizeof(filename)) { ++ PR_CloseDir(dir); ++ return -1; ++ } + if (rm_dash_r(filename)) { + PR_CloseDir(dir); + return -1; + } + } + + if (PR_CloseDir(dir) != PR_SUCCESS) { + return -1; +diff --git a/cmd/signtool/util.c b/cmd/signtool/util.c +--- a/cmd/signtool/util.c ++++ b/cmd/signtool/util.c +@@ -132,17 +132,20 @@ rm_dash_r(char *path) + if (!dir) { + PR_fprintf(errorFD, "Error: Unable to open directory %s.\n", path); + errorCount++; + return -1; + } + + /* Recursively delete all entries in the directory */ + while ((entry = PR_ReadDir(dir, PR_SKIP_BOTH)) != NULL) { +- sprintf(filename, "%s/%s", path, entry->name); ++ if (snprintf(filename, sizeof(filename), "%s/%s", path, entry->name) >= sizeof(filename)) { ++ errorCount++; ++ return -1; ++ } + if (rm_dash_r(filename)) + return -1; + } + + if (PR_CloseDir(dir) != PR_SUCCESS) { + PR_fprintf(errorFD, "Error: Could not close %s.\n", path); + errorCount++; + return -1; +diff --git a/lib/libpkix/pkix/util/pkix_list.c b/lib/libpkix/pkix/util/pkix_list.c +--- a/lib/libpkix/pkix/util/pkix_list.c ++++ b/lib/libpkix/pkix/util/pkix_list.c +@@ -1530,17 +1530,17 @@ cleanup: + */ + PKIX_Error * + PKIX_List_SetItem( + PKIX_List *list, + PKIX_UInt32 index, + PKIX_PL_Object *item, + void *plContext) + { +- PKIX_List *element; ++ PKIX_List *element = NULL; + + PKIX_ENTER(LIST, "PKIX_List_SetItem"); + PKIX_NULLCHECK_ONE(list); + + if (list->immutable){ + PKIX_ERROR(PKIX_OPERATIONNOTPERMITTEDONIMMUTABLELIST); + } + +diff --git a/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.c b/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.c +--- a/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.c ++++ b/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.c +@@ -102,17 +102,17 @@ cleanup: + */ + static PKIX_Error * + pkix_pl_OID_Equals( + PKIX_PL_Object *first, + PKIX_PL_Object *second, + PKIX_Boolean *pResult, + void *plContext) + { +- PKIX_Int32 cmpResult; ++ PKIX_Int32 cmpResult = 0; + + PKIX_ENTER(OID, "pkix_pl_OID_Equals"); + PKIX_NULLCHECK_THREE(first, second, pResult); + + PKIX_CHECK(pkix_pl_OID_Comparator + (first, second, &cmpResult, plContext), + PKIX_OIDCOMPARATORFAILED); + diff --git a/nss.spec b/nss.spec index bca2a8b..35ab885 100644 --- a/nss.spec +++ b/nss.spec @@ -112,6 +112,7 @@ Patch10: nss-3.47-ike-fix.patch # as it still doesn't work under FIPS mode because of missing HKDF # support in PKCS #11. Patch11: nss-tls13-default.patch +Patch12: nss-signtool-format.patch %description Network Security Services (NSS) is a set of libraries designed to @@ -885,6 +886,7 @@ update-crypto-policies &> /dev/null || : %changelog * Fri Feb 14 2020 Daiki Ueno - 3.49.2-3 - Ignore false-positive compiler warnings with gcc 10 +- Fix build with gcc 10 * Wed Jan 29 2020 Fedora Release Engineering - 3.49.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild