mirror of https://github.com/wolfSSL/wolfssh.git
Merge pull request #72 from ejohnstown/static-fixes
fix a handful of clang static analysis warningspull/74/head
commit
0fc6f343b0
|
@ -564,8 +564,6 @@ THREAD_RETURN WOLFSSH_THREAD server_test(void* args)
|
||||||
byte buf[SCRATCH_BUFFER_SZ];
|
byte buf[SCRATCH_BUFFER_SZ];
|
||||||
word32 bufSz;
|
word32 bufSz;
|
||||||
|
|
||||||
bufName = useEcc ? "./keys/server-key-ecc.der" :
|
|
||||||
"./keys/server-key-rsa.der" ;
|
|
||||||
bufSz = load_key(useEcc, buf, SCRATCH_BUFFER_SZ);
|
bufSz = load_key(useEcc, buf, SCRATCH_BUFFER_SZ);
|
||||||
if (bufSz == 0) {
|
if (bufSz == 0) {
|
||||||
fprintf(stderr, "Couldn't load key.\n");
|
fprintf(stderr, "Couldn't load key.\n");
|
||||||
|
|
|
@ -1038,9 +1038,11 @@ int ChannelRemove(WOLFSSH* ssh, word32 channel, byte peer)
|
||||||
if (ssh == NULL)
|
if (ssh == NULL)
|
||||||
ret = WS_BAD_ARGUMENT;
|
ret = WS_BAD_ARGUMENT;
|
||||||
|
|
||||||
list = ssh->channelList;
|
if (ret == WS_SUCCESS) {
|
||||||
if (list == NULL)
|
list = ssh->channelList;
|
||||||
ret = WS_INVALID_CHANID;
|
if (list == NULL)
|
||||||
|
ret = WS_INVALID_CHANID;
|
||||||
|
}
|
||||||
|
|
||||||
if (ret == WS_SUCCESS) {
|
if (ret == WS_SUCCESS) {
|
||||||
WOLFSSH_CHANNEL* prev = NULL;
|
WOLFSSH_CHANNEL* prev = NULL;
|
||||||
|
|
11
tests/unit.c
11
tests/unit.c
|
@ -397,7 +397,8 @@ static int test_Errors(void)
|
||||||
#else
|
#else
|
||||||
int i, j = 0;
|
int i, j = 0;
|
||||||
/* Values that are not or no longer error codes. */
|
/* Values that are not or no longer error codes. */
|
||||||
int missing[] = { WS_SUCCESS };
|
int missing[] = { 0 };
|
||||||
|
int missingSz = (int)sizeof(missing)/sizeof(missing[0]);
|
||||||
|
|
||||||
/* Check that all errors have a string and it's the same through the two
|
/* Check that all errors have a string and it's the same through the two
|
||||||
* APIs. Check that the values that are not errors map to the unknown
|
* APIs. Check that the values that are not errors map to the unknown
|
||||||
|
@ -405,15 +406,15 @@ static int test_Errors(void)
|
||||||
for (i = WS_SUCCESS; i >= WS_LAST_E; i--) {
|
for (i = WS_SUCCESS; i >= WS_LAST_E; i--) {
|
||||||
errStr = wolfSSH_ErrorToName(i);
|
errStr = wolfSSH_ErrorToName(i);
|
||||||
|
|
||||||
if (i != missing[j]) {
|
if (j < missingSz && i == missing[j]) {
|
||||||
if (errStr == unknownStr) {
|
j++;
|
||||||
|
if (errStr != unknownStr) {
|
||||||
result = -105;
|
result = -105;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
j++;
|
if (errStr == unknownStr) {
|
||||||
if (errStr != unknownStr) {
|
|
||||||
result = -106;
|
result = -106;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue