Skip to content

Commit 8a714b2

Browse files
authored
Merge pull request #404 from gojimmypi/Initialize_Variables
initialize pointers to NULL, others to zero
2 parents 975283f + d99f3fc commit 8a714b2

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

src/internal.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -949,8 +949,8 @@ int GenerateKey(byte hashId, byte keyId,
949949

950950
static int GenerateKeys(WOLFSSH* ssh, byte hashId)
951951
{
952-
Keys* cK;
953-
Keys* sK;
952+
Keys* cK = NULL;
953+
Keys* sK = NULL;
954954
int ret = WS_SUCCESS;
955955

956956
if (ssh == NULL)
@@ -3151,7 +3151,7 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx)
31513151

31523152
if (sigKeyBlock_ptr->useRsa) {
31533153
#ifndef WOLFSSH_NO_RSA
3154-
byte* e;
3154+
byte* e = NULL;
31553155
word32 eSz;
31563156
byte* n;
31573157
word32 nSz;
@@ -3972,7 +3972,7 @@ static int DoUserAuthRequestPassword(WOLFSSH* ssh, WS_UserAuthData* authData,
39723972
byte* buf, word32 len, word32* idx)
39733973
{
39743974
word32 begin;
3975-
WS_UserAuthData_Password* pw;
3975+
WS_UserAuthData_Password* pw = NULL;
39763976
int ret = WS_SUCCESS;
39773977

39783978
WLOG(WS_LOG_DEBUG, "Entering DoUserAuthRequestPassword()");
@@ -4410,7 +4410,7 @@ static int DoUserAuthRequestPublicKey(WOLFSSH* ssh, WS_UserAuthData* authData,
44104410
byte* buf, word32 len, word32* idx)
44114411
{
44124412
word32 begin;
4413-
WS_UserAuthData_PublicKey* pk;
4413+
WS_UserAuthData_PublicKey* pk = NULL;
44144414
int ret = WS_SUCCESS;
44154415
int authFailure = 0;
44164416

@@ -4946,7 +4946,7 @@ static int DoChannelOpen(WOLFSSH* ssh,
49464946
word32 hostPort = 0, originPort = 0;
49474947
int isDirect = 0;
49484948
#endif /* WOLFSSH_FWD */
4949-
WOLFSSH_CHANNEL* newChannel;
4949+
WOLFSSH_CHANNEL* newChannel = NULL;
49504950
int ret = WS_SUCCESS;
49514951

49524952
WLOG(WS_LOG_DEBUG, "Entering DoChannelOpen()");
@@ -6853,8 +6853,8 @@ int SendKexDhReply(WOLFSSH* ssh)
68536853
byte useEcc = 0;
68546854
byte fPad = 0;
68556855
byte kPad = 0;
6856-
word32 sigBlockSz;
6857-
word32 payloadSz;
6856+
word32 sigBlockSz = 0;
6857+
word32 payloadSz = 0;
68586858
word32 scratch = 0;
68596859
byte* output;
68606860
word32 idx;
@@ -8885,11 +8885,11 @@ int SendUserAuthRequest(WOLFSSH* ssh, byte authId, int addSig)
88858885
{
88868886
byte* output;
88878887
word32 idx;
8888-
const char* authName;
8889-
word32 authNameSz;
8890-
const char* serviceName;
8891-
word32 serviceNameSz;
8892-
word32 payloadSz;
8888+
const char* authName = NULL;
8889+
word32 authNameSz = 0;
8890+
const char* serviceName = NULL;
8891+
word32 serviceNameSz = 0;
8892+
word32 payloadSz = 0;
88938893
int ret = WS_SUCCESS;
88948894
WS_UserAuthData authData;
88958895
WS_KeySignature *keySig_ptr = NULL;
@@ -9284,8 +9284,8 @@ static int SendChannelOpen(WOLFSSH* ssh, WOLFSSH_CHANNEL* channel,
92849284
byte* channelData, word32 channelDataSz)
92859285
{
92869286
byte* output;
9287-
const char* channelType;
9288-
word32 channelTypeSz, idx;
9287+
const char* channelType = NULL;
9288+
word32 channelTypeSz = 0, idx;
92899289
int ret = WS_SUCCESS;
92909290

92919291
WLOG(WS_LOG_DEBUG, "Entering SendChannelOpen()");
@@ -9449,7 +9449,7 @@ int SendChannelEof(WOLFSSH* ssh, word32 peerChannelId)
94499449
byte* output;
94509450
word32 idx;
94519451
int ret = WS_SUCCESS;
9452-
WOLFSSH_CHANNEL* channel;
9452+
WOLFSSH_CHANNEL* channel = NULL;
94539453

94549454
WLOG(WS_LOG_DEBUG, "Entering SendChannelEof()");
94559455

@@ -9503,7 +9503,7 @@ int SendChannelEow(WOLFSSH* ssh, word32 peerChannelId)
95039503
word32 idx;
95049504
word32 strSz = sizeof("eow@openssh.com");
95059505
int ret = WS_SUCCESS;
9506-
WOLFSSH_CHANNEL* channel;
9506+
WOLFSSH_CHANNEL* channel = NULL;
95079507

95089508
WLOG(WS_LOG_DEBUG, "Entering SendChannelEow()");
95099509

@@ -9557,7 +9557,7 @@ int SendChannelExit(WOLFSSH* ssh, word32 peerChannelId, int status)
95579557
word32 idx;
95589558
word32 strSz = sizeof("exit-status");
95599559
int ret = WS_SUCCESS;
9560-
WOLFSSH_CHANNEL* channel;
9560+
WOLFSSH_CHANNEL* channel = NULL;
95619561

95629562
WLOG(WS_LOG_DEBUG, "Entering SendChannelExit(), status = %d", status);
95639563

@@ -9607,7 +9607,7 @@ int SendChannelClose(WOLFSSH* ssh, word32 peerChannelId)
96079607
byte* output;
96089608
word32 idx;
96099609
int ret = WS_SUCCESS;
9610-
WOLFSSH_CHANNEL* channel;
9610+
WOLFSSH_CHANNEL* channel = NULL;
96119611

96129612
WLOG(WS_LOG_DEBUG, "Entering SendChannelClose()");
96139613

@@ -9656,7 +9656,7 @@ int SendChannelData(WOLFSSH* ssh, word32 channelId,
96569656
byte* output;
96579657
word32 idx;
96589658
int ret = WS_SUCCESS;
9659-
WOLFSSH_CHANNEL* channel;
9659+
WOLFSSH_CHANNEL* channel = NULL;
96609660

96619661
WLOG(WS_LOG_DEBUG, "Entering SendChannelData()");
96629662

@@ -9800,7 +9800,7 @@ int SendChannelRequest(WOLFSSH* ssh, byte* name, word32 nameSz)
98009800
byte* output;
98019801
word32 idx;
98029802
int ret = WS_SUCCESS;
9803-
WOLFSSH_CHANNEL* channel;
9803+
WOLFSSH_CHANNEL* channel = NULL;
98049804
const char* cType = NULL;
98059805
word32 typeSz = 0;
98069806

@@ -10196,7 +10196,7 @@ int SendChannelSuccess(WOLFSSH* ssh, word32 channelId, int success)
1019610196
byte* output;
1019710197
word32 idx;
1019810198
int ret = WS_SUCCESS;
10199-
WOLFSSH_CHANNEL* channel;
10199+
WOLFSSH_CHANNEL* channel = NULL;
1020010200

1020110201
WLOG(WS_LOG_DEBUG, "Entering SendChannelSuccess(), %s",
1020210202
success ? "Success" : "Failure");

0 commit comments

Comments
 (0)