mirror of https://github.com/wolfSSL/wolfssh.git
scan-build fixes
1. Didn't initialize errFd before calling select() in wolffwd. 2. Wasn't checking the accepted appFd in wolffwd. 3. For the test_KDF() unit test, a call to ConvertHexToBin() could succeed and leave eKey NULL, and pass it to memcmp().pull/98/head
parent
f8f3d125b6
commit
8a13a829df
|
@ -341,6 +341,8 @@ THREAD_RETURN WOLFSSH_THREAD wolffwd_worker(void* args)
|
|||
|
||||
for (;;) {
|
||||
rxFds = templateFds;
|
||||
errFds = templateFds;
|
||||
|
||||
to.tv_sec = 1;
|
||||
to.tv_usec = 0;
|
||||
ret = select(nFds, &rxFds, NULL, &errFds, &to);
|
||||
|
@ -395,6 +397,8 @@ THREAD_RETURN WOLFSSH_THREAD wolffwd_worker(void* args)
|
|||
if (!appFdSet && FD_ISSET(listenFd, &rxFds)) {
|
||||
appFd = accept(listenFd,
|
||||
(struct sockaddr*)&fwdFromHostAddr, &fwdFromHostAddrSz);
|
||||
if (appFd < 0)
|
||||
break;
|
||||
FD_SET(appFd, &templateFds);
|
||||
nFds = appFd + 1;
|
||||
appFdSet = 1;
|
||||
|
|
|
@ -327,7 +327,7 @@ static int test_KDF(void)
|
|||
tv->h, &h, &hSz,
|
||||
tv->sessionId, &sId, &sIdSz,
|
||||
tv->expectedKey, &eKey, &eKeySz);
|
||||
if (result != 0) {
|
||||
if (result != 0 || eKey == NULL) {
|
||||
printf("KDF: Could not convert test vector %u.\n", i);
|
||||
return -100;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue