@@ -13387,7 +13387,7 @@ int SendUserAuthKeyboardRequest(WOLFSSH* ssh, WS_UserAuthData* authData)
1338713387 ssh->keyboardAuthCtx);
1338813388 }
1338913389
13390- if (authData->sf.keyboard.promptCount > 0 &&
13390+ if (authData && authData ->sf.keyboard.promptCount > 0 &&
1339113391 (authData->sf.keyboard.prompts == NULL ||
1339213392 authData->sf.keyboard.promptLengths == NULL ||
1339313393 authData->sf.keyboard.promptEcho == NULL)) {
@@ -13399,7 +13399,8 @@ int SendUserAuthKeyboardRequest(WOLFSSH* ssh, WS_UserAuthData* authData)
1339913399 ret = WS_BAD_USAGE;
1340013400 }
1340113401
13402- ssh->kbAuth.promptCount = authData->sf.keyboard.promptCount;
13402+ if (ret == WS_SUCCESS)
13403+ ssh->kbAuth.promptCount = authData->sf.keyboard.promptCount;
1340313404
1340413405 payloadSz = MSG_ID_SZ;
1340513406 if (ret == WS_SUCCESS) {
@@ -13410,12 +13411,12 @@ int SendUserAuthKeyboardRequest(WOLFSSH* ssh, WS_UserAuthData* authData)
1341013411 ret = PreparePacket(ssh, payloadSz);
1341113412 }
1341213413
13413- output = ssh->outputBuffer.buffer;
13414- idx = ssh->outputBuffer.length;
13414+ if (ret == WS_SUCCESS) {
13415+ output = ssh->outputBuffer.buffer;
13416+ idx = ssh->outputBuffer.length;
1341513417
13416- output[idx++] = MSGID_USERAUTH_INFO_REQUEST;
13418+ output[idx++] = MSGID_USERAUTH_INFO_REQUEST;
1341713419
13418- if (ret == WS_SUCCESS) {
1341913420 ret = BuildUserAuthRequestKeyboard(ssh, output, &idx, authData);
1342013421 }
1342113422
0 commit comments