| 1 |
Description: Fix FTBFS on s390x |
| 2 |
error: ‘element’ may be used uninitialized in this function |
| 3 |
error: ‘cmpResult’ may be used uninitialized in this function |
| 4 |
error: ‘value’ may be used uninitialized in this function |
| 5 |
error: sprintf may write a terminating nul past the end of the destination |
| 6 |
Author: Eduardo Barretto <[email protected]> |
| 7 |
|
| 8 |
--- a/nss/nss/cmd/certutil/certext.c |
| 9 |
+++ b/nss/nss/cmd/certutil/certext.c |
| 10 |
@@ -345,7 +345,7 @@ AddKeyUsage(void *extHandle, const char |
| 11 |
SECItem bitStringValue; |
| 12 |
unsigned char keyUsage = 0x0; |
| 13 |
char buffer[5]; |
| 14 |
- int value; |
| 15 |
+ int value = 0; |
| 16 |
PRBool isCriticalExt = PR_FALSE; |
| 17 |
|
| 18 |
if (!userSuppliedValue) { |
| 19 |
@@ -523,7 +523,7 @@ static SECStatus |
| 20 |
AddExtKeyUsage(void *extHandle, const char *userSuppliedValue) |
| 21 |
{ |
| 22 |
char buffer[5]; |
| 23 |
- int value; |
| 24 |
+ int value = 0; |
| 25 |
CERTOidSequence *os; |
| 26 |
SECStatus rv; |
| 27 |
SECItem *item; |
| 28 |
@@ -685,7 +685,7 @@ AddNscpCertType(void *extHandle, const c |
| 29 |
SECItem bitStringValue; |
| 30 |
unsigned char keyUsage = 0x0; |
| 31 |
char buffer[5]; |
| 32 |
- int value; |
| 33 |
+ int value = 0; |
| 34 |
PRBool isCriticalExt = PR_FALSE; |
| 35 |
|
| 36 |
if (!userSuppliedValue) { |
| 37 |
--- a/nss/nss/cmd/modutil/install.c |
| 38 |
+++ b/nss/nss/cmd/modutil/install.c |
| 39 |
@@ -798,6 +798,7 @@ rm_dash_r(char *path) |
| 40 |
PRDirEntry *entry; |
| 41 |
PRFileInfo fileinfo; |
| 42 |
char filename[240]; |
| 43 |
+ int count; |
| 44 |
|
| 45 |
if (PR_GetFileInfo(path, &fileinfo) != PR_SUCCESS) { |
| 46 |
/*fprintf(stderr, "Error: Unable to access %s\n", filename);*/ |
| 47 |
@@ -812,7 +813,11 @@ rm_dash_r(char *path) |
| 48 |
|
| 49 |
/* Recursively delete all entries in the directory */ |
| 50 |
while ((entry = PR_ReadDir(dir, PR_SKIP_BOTH)) != NULL) { |
| 51 |
- snprintf(filename, sizeof(filename), "%s/%s", path, entry->name); |
| 52 |
+ count = snprintf(filename, sizeof(filename), "%s/%s", path, entry->name); |
| 53 |
+ if (count >= sizeof(filename)) { |
| 54 |
+ PR_fprintf(PR_STDERR, "Error: Unable to find filename %s\n", filename); |
| 55 |
+ return -1; |
| 56 |
+ } |
| 57 |
if (rm_dash_r(filename)) { |
| 58 |
PR_CloseDir(dir); |
| 59 |
return -1; |
| 60 |
--- a/nss/nss/cmd/signtool/util.c |
| 61 |
+++ b/nss/nss/cmd/signtool/util.c |
| 62 |
@@ -121,6 +121,7 @@ rm_dash_r(char *path) |
| 63 |
PRDirEntry *entry; |
| 64 |
PRFileInfo fileinfo; |
| 65 |
char filename[FNSIZE]; |
| 66 |
+ int count; |
| 67 |
|
| 68 |
if (PR_GetFileInfo(path, &fileinfo) != PR_SUCCESS) { |
| 69 |
/*fprintf(stderr, "Error: Unable to access %s\n", filename);*/ |
| 70 |
@@ -137,7 +138,12 @@ rm_dash_r(char *path) |
| 71 |
|
| 72 |
/* Recursively delete all entries in the directory */ |
| 73 |
while ((entry = PR_ReadDir(dir, PR_SKIP_BOTH)) != NULL) { |
| 74 |
- snprintf(filename, sizeof(filename), "%s/%s", path, entry->name); |
| 75 |
+ count = snprintf(filename, sizeof(filename), "%s/%s", path, entry->name); |
| 76 |
+ if (count >= sizeof(filename)) { |
| 77 |
+ PR_fprintf(errorFD, "Error: Unable to find filename %s.\n", filename); |
| 78 |
+ errorCount++; |
| 79 |
+ exit(ERRX); |
| 80 |
+ } |
| 81 |
if (rm_dash_r(filename)) { |
| 82 |
PR_CloseDir(dir); |
| 83 |
return -1; |
| 84 |
--- a/nss/nss/lib/libpkix/pkix/util/pkix_list.c |
| 85 |
+++ b/nss/nss/lib/libpkix/pkix/util/pkix_list.c |
| 86 |
@@ -1535,7 +1535,7 @@ PKIX_List_SetItem( |
| 87 |
PKIX_PL_Object *item, |
| 88 |
void *plContext) |
| 89 |
{ |
| 90 |
- PKIX_List *element; |
| 91 |
+ PKIX_List *element = NULL; |
| 92 |
|
| 93 |
PKIX_ENTER(LIST, "PKIX_List_SetItem"); |
| 94 |
PKIX_NULLCHECK_ONE(list); |
| 95 |
--- a/nss/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.c |
| 96 |
+++ b/nss/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.c |
| 97 |
@@ -107,7 +107,7 @@ pkix_pl_OID_Equals( |
| 98 |
PKIX_Boolean *pResult, |
| 99 |
void *plContext) |
| 100 |
{ |
| 101 |
- PKIX_Int32 cmpResult; |
| 102 |
+ PKIX_Int32 cmpResult = 0; |
| 103 |
|
| 104 |
PKIX_ENTER(OID, "pkix_pl_OID_Equals"); |
| 105 |
PKIX_NULLCHECK_THREE(first, second, pResult); |