1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-08 19:02:06 +03:00

pki: Initialize pointers to NULL

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2018-09-11 15:05:41 +02:00
committed by Andreas Schneider
parent 9d2de880ec
commit 8f7214a584
2 changed files with 16 additions and 16 deletions

View File

@@ -813,7 +813,7 @@ ssh_private_key ssh_pki_convert_key_to_privatekey(const ssh_key key) {
static int pki_import_pubkey_buffer(ssh_buffer buffer, static int pki_import_pubkey_buffer(ssh_buffer buffer,
enum ssh_keytypes_e type, enum ssh_keytypes_e type,
ssh_key *pkey) { ssh_key *pkey) {
ssh_key key; ssh_key key = NULL;
int rc; int rc;
key = ssh_key_new(); key = ssh_key_new();
@@ -828,10 +828,10 @@ static int pki_import_pubkey_buffer(ssh_buffer buffer,
switch (type) { switch (type) {
case SSH_KEYTYPE_DSS: case SSH_KEYTYPE_DSS:
{ {
ssh_string p; ssh_string p = NULL;
ssh_string q; ssh_string q = NULL;
ssh_string g; ssh_string g = NULL;
ssh_string pubkey; ssh_string pubkey = NULL;
p = ssh_buffer_get_ssh_string(buffer); p = ssh_buffer_get_ssh_string(buffer);
if (p == NULL) { if (p == NULL) {
@@ -886,8 +886,8 @@ static int pki_import_pubkey_buffer(ssh_buffer buffer,
break; break;
case SSH_KEYTYPE_RSA: case SSH_KEYTYPE_RSA:
{ {
ssh_string e; ssh_string e = NULL;
ssh_string n; ssh_string n = NULL;
e = ssh_buffer_get_ssh_string(buffer); e = ssh_buffer_get_ssh_string(buffer);
if (e == NULL) { if (e == NULL) {
@@ -918,8 +918,8 @@ static int pki_import_pubkey_buffer(ssh_buffer buffer,
#ifdef HAVE_ECC #ifdef HAVE_ECC
case SSH_KEYTYPE_ECDSA: case SSH_KEYTYPE_ECDSA:
{ {
ssh_string e; ssh_string e = NULL;
ssh_string i; ssh_string i = NULL;
int nid; int nid;
i = ssh_buffer_get_ssh_string(buffer); i = ssh_buffer_get_ssh_string(buffer);
@@ -1058,8 +1058,8 @@ fail:
int ssh_pki_import_pubkey_base64(const char *b64_key, int ssh_pki_import_pubkey_base64(const char *b64_key,
enum ssh_keytypes_e type, enum ssh_keytypes_e type,
ssh_key *pkey) { ssh_key *pkey) {
ssh_buffer buffer; ssh_buffer buffer = NULL;
ssh_string type_s; ssh_string type_s = NULL;
int rc; int rc;
if (b64_key == NULL || pkey == NULL) { if (b64_key == NULL || pkey == NULL) {
@@ -1106,7 +1106,7 @@ int ssh_pki_import_pubkey_base64(const char *b64_key,
*/ */
int ssh_pki_import_pubkey_blob(const ssh_string key_blob, int ssh_pki_import_pubkey_blob(const ssh_string key_blob,
ssh_key *pkey) { ssh_key *pkey) {
ssh_buffer buffer; ssh_buffer buffer = NULL;
ssh_string type_s = NULL; ssh_string type_s = NULL;
enum ssh_keytypes_e type; enum ssh_keytypes_e type;
int rc; int rc;

View File

@@ -174,8 +174,8 @@ static ssh_string make_ecpoint_string(const EC_GROUP *g,
int pki_pubkey_build_ecdsa(ssh_key key, int nid, ssh_string e) int pki_pubkey_build_ecdsa(ssh_key key, int nid, ssh_string e)
{ {
EC_POINT *p; EC_POINT *p = NULL;
const EC_GROUP *g; const EC_GROUP *g = NULL;
int ok; int ok;
key->ecdsa_nid = nid; key->ecdsa_nid = nid;
@@ -894,7 +894,7 @@ int pki_pubkey_build_dss(ssh_key key,
ssh_string g, ssh_string g,
ssh_string pubkey) { ssh_string pubkey) {
int rc; int rc;
BIGNUM *bp, *bq, *bg, *bpub_key; BIGNUM *bp = NULL, *bq = NULL, *bg = NULL, *bpub_key = NULL;
key->dsa = DSA_new(); key->dsa = DSA_new();
if (key->dsa == NULL) { if (key->dsa == NULL) {
@@ -930,7 +930,7 @@ int pki_pubkey_build_rsa(ssh_key key,
ssh_string e, ssh_string e,
ssh_string n) { ssh_string n) {
int rc; int rc;
BIGNUM *be, *bn; BIGNUM *be = NULL, *bn = NULL;
key->rsa = RSA_new(); key->rsa = RSA_new();
if (key->rsa == NULL) { if (key->rsa == NULL) {