[PATCH] fixed unitialized variable pemInternalObject
by Oliver Graute
pinst.c: In function 'AddCertificate':
pinst.c:624:16: error: 'o' may be used uninitialized in this function [-Werror=maybe-uninitialized]
nss_ZFreeIf(o);
Index: /nss/lib/ckfw/pem/pinst.c
===================================================================
--- /nss/lib/ckfw/pem/pinst.c 2016-03-29 09:40:38.610877201 +0200
+++ /nss/lib/ckfw/pem/pinst.c 2016-03-29 09:45:10.554297883 +0200
@@ -534,7 +534,7 @@
AddCertificate(char *certfile, char *keyfile, PRBool cacert,
CK_SLOT_ID slotID)
{
- pemInternalObject *o;
+ pemInternalObject *o = NULL;
CK_RV error = 0;
int objid, i = 0;
int nobjs = 0;
8 years, 1 month
[PATCH] fixed unitialized variable i
by Oliver Graute
pinst.c: In function 'AddCertificate':
pinst.c:584:18: error: 'i' may be used uninitialized in this function [-Werror=maybe-uninitialized]
nickname = getUniquePEMNicknameFromFilename(certfile, i);
Index: /nss/lib/ckfw/pem/pinst.c
===================================================================
--- /nss/lib/ckfw/pem/pinst.c 2016-03-29 09:16:40.617666212 +0200
+++ /nss/lib/ckfw/pem/pinst.c 2016-03-29 09:17:14.754591533 +0200
@@ -536,7 +536,7 @@
{
pemInternalObject *o;
CK_RV error = 0;
- int objid, i;
+ int objid, i = 0;
int nobjs = 0;
SECItem **objs = NULL;
char *ivstring = NULL;
8 years, 1 month
Re: Howto use libcurl with libnss and PKCS11 Interface to a Security Module?
by Kamil Dudka
On Tuesday 29 March 2016 10:18:01 Oliver Graute wrote:
> then I got this error caused by uninitialized variable.
>
> 4_glibc_PTH_64_OPT.OBJ/include -I../../../../dist/public/nss
> -I../../../../dist/private/nss -I../../../../dist/public/nspr pinst.c
> | pinst.c: In function 'AddCertificate':
> | pinst.c:584:18: error: 'i' may be used uninitialized in this function
> | [-Werror=maybe-uninitialized]|
> | nickname = getUniquePEMNicknameFromFilename(certfile, i);
> |
> | ^
>
> and this:
>
> 4_glibc_PTH_64_OPT.OBJ/include -I../../../../dist/public/nss
> -I../../../../dist/private/nss -I../../../../dist/public/nspr pinst.c
> | pinst.c: In function 'AddCertificate':
> | pinst.c:624:16: error: 'o' may be used uninitialized in this function
> | [-Werror=maybe-uninitialized]|
> | nss_ZFreeIf(o);
> |
> | ^
> |
> | cc1: all warnings being treated as errors
>
> I fixed both with attached patches.
Thanks for the patches! I have squashed them to a single commit and pushed:
https://git.fedorahosted.org/cgit/nss-pem.git/commit/?id=429b0222
I am afraid that many other similar issues are still lurking in the code
of AddCertificate(). The function is full of copy/pasted code that has
been fixed in its original location only, because the code path is not
used by curl, nor any other software I know of.
> I will send them to nss-dev to.
nss-pem is not part of the upstream nss. The correct mailing list for such
patches is nss-pem-devel (CC'd).
Kamil
> Best Regards,
>
> Oliver
8 years, 1 month