kumquat-buildroot/package/opensc/0001-Fix-maybe-uninitialized-errors.patch
José Pekkarinen 8aaa7ecbce package/opensc: new package
Signed-off-by: José Pekkarinen <jose.pekkarinen@unikie.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-07-24 14:37:59 +02:00

83 lines
2.7 KiB
Diff

From bcb39d6f4d2dee6beb035cb2f3618174ec1cb2b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Pekkarinen?= <jose.pekkarinen@unikie.com>
Date: Fri, 10 Dec 2021 13:54:26 +0200
Subject: [PATCH] Fix maybe uninitialized errors
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: José Pekkarinen <jose.pekkarinen@unikie.com>
Upstream: https://github.com/OpenSC/OpenSC/commit/05ec8c7fe785a2b9aeaac1164adb349df42b7f80
---
src/libopensc/pkcs15-coolkey.c | 12 ++++++------
src/pkcs15init/pkcs15-asepcos.c | 2 +-
src/tools/opensc-explorer.c | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/libopensc/pkcs15-coolkey.c b/src/libopensc/pkcs15-coolkey.c
index 586475dd..15684cef 100644
--- a/src/libopensc/pkcs15-coolkey.c
+++ b/src/libopensc/pkcs15-coolkey.c
@@ -147,9 +147,9 @@ coolkey_find_matching_cert(sc_card_t *card, sc_cardctl_coolkey_object_t *in_obj,
static int
coolkey_get_attribute_ulong(sc_card_t *card, sc_cardctl_coolkey_object_t *obj, CK_ATTRIBUTE_TYPE type, CK_ULONG *value)
{
- const u8 *val;
- size_t val_len;
- u8 data_type;
+ const u8 *val = NULL;
+ size_t val_len = 0;
+ u8 data_type = 0;
int r;
r = coolkey_get_attribute(card, obj, type, &val, &val_len, &data_type);
@@ -168,8 +168,8 @@ static int
coolkey_get_attribute_boolean(sc_card_t *card, sc_cardctl_coolkey_object_t *obj, CK_ATTRIBUTE_TYPE attr_type)
{
int r;
- const u8 *val;
- size_t val_len;
+ const u8 *val = NULL;
+ size_t val_len = 0;
r = coolkey_get_attribute(card, obj, attr_type, &val, &val_len, NULL);
if (r < 0) {
@@ -186,7 +186,7 @@ static int
coolkey_get_attribute_bytes(sc_card_t *card, sc_cardctl_coolkey_object_t *obj, CK_ATTRIBUTE_TYPE type, u8 *data, size_t *data_len, size_t max_data_len)
{
const u8 *val;
- size_t val_len;
+ size_t val_len = 0;
int r;
r = coolkey_get_attribute(card, obj, type, &val, &val_len, NULL);
diff --git a/src/pkcs15init/pkcs15-asepcos.c b/src/pkcs15init/pkcs15-asepcos.c
index d7122012..bc0efb5c 100644
--- a/src/pkcs15init/pkcs15-asepcos.c
+++ b/src/pkcs15init/pkcs15-asepcos.c
@@ -221,7 +221,7 @@ static int asepcos_do_store_pin(sc_profile_t *profile, sc_card_t *card,
{
sc_file_t *nfile = NULL;
u8 buf[64], sbuf[64], *p = buf, *q = sbuf;
- int r, akn;
+ int r, akn = 0;
if (auth_info->auth_type != SC_PKCS15_PIN_AUTH_TYPE_PIN)
return SC_ERROR_OBJECT_NOT_VALID;
diff --git a/src/tools/opensc-explorer.c b/src/tools/opensc-explorer.c
index 9ec4daa1..04efdf8f 100644
--- a/src/tools/opensc-explorer.c
+++ b/src/tools/opensc-explorer.c
@@ -2472,7 +2472,7 @@ int main(int argc, char *argv[])
char *line;
int cargc;
char *cargv[260];
- int multiple;
+ int multiple = 0;
struct command *cmd;
char prompt[3*SC_MAX_PATH_STRING_SIZE];
--
2.25.1