Actions
Bug #5591
closedinitialisation inversion of component order in cmd-crypto/elfsign.c
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2015-02-04
Due date:
% Done:
100%
Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:
External Bug:
Description
KMF_DATA is defined thus:
typedef struct kmf_data { size_t Length; /* in bytes */ uchar_t *Data; } KMF_DATA;
therefore, the following patch fixes the initialisation order of the components:
diff --git a/usr/src/cmd/cmd-crypto/elfsign/elfsign.c b/usr/src/cmd/cmd-crypto/e index 45ae510..b11da36 100644 --- a/usr/src/cmd/cmd-crypto/elfsign/elfsign.c +++ b/usr/src/cmd/cmd-crypto/elfsign/elfsign.c @@ -736,7 +736,7 @@ create_csr(char *dn) KMF_X509_NAME csrSubject; KMF_CSR_DATA csr; KMF_ALGORITHM_INDEX sigAlg = KMF_ALGID_MD5WithRSA; - KMF_DATA signedCsr = { NULL, 0 }; + KMF_DATA signedCsr = { 0, NULL }; char *err; KMF_ATTRIBUTE attrlist[16]; KMF_ENCODE_FORMAT format;
Updated by Andrew Stormont over 8 years ago
It should be possible to initialise with just a zero:
KMF_DATA signedCsr = { 0 };
Updated by Richard PALO over 8 years ago
Andrew Stormont wrote:
It should be possible to initialise with just a zero:
[...]
Hi Andrew, personally I am not fond of 'catch all' initialisers that
abuse the laxness of C.
I am would be more inclined to add, and consequently use, a constant such as:
#define KMF_DATA_ZERO { 0, NULL }
please see https://reviews.csiden.org/r/161/
Updated by Electric Monk over 8 years ago
- Status changed from New to Closed
- % Done changed from 90 to 100
git commit 6b35cb3cf158584a9408d44b9b6796564e8e1882
commit 6b35cb3cf158584a9408d44b9b6796564e8e1882 Author: Richard PALO <richard@NetBSD.org> Date: 2015-02-17T01:33:42.000Z 5591 initialisation inversion of component order in cmd-crypto/elfsign.c 5620 cstyle updates for cmd/cmd-crypto and lib/libkmf Reviewed by: Dan McDonald <danmcd@omniti.com> Reviewed by: David Höppner <0xffea@gmail.com> Reviewed by: Josef "Jeff" Sipek <jeffpc@josefsipek.net> Approved by: Dan McDonald <danmcd@omniti.com>
Actions