File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8346,7 +8346,7 @@ static int DoUserAuthRequest(WOLFSSH* ssh,
83468346 word32 begin;
83478347 int ret = WS_SUCCESS;
83488348 byte authNameId = ID_UNKNOWN;
8349- byte serviceValid = 1;
8349+ int serviceValid = 1;
83508350 WS_UserAuthData authData;
83518351
83528352 WLOG(WS_LOG_DEBUG, "Entering DoUserAuthRequest()");
Original file line number Diff line number Diff line change @@ -1435,7 +1435,8 @@ static int test_DoUserAuthRequest_serviceName(void)
14351435 /* service name */
14361436 buf [len ++ ] = (byte )(snsz >> 24 ); buf [len ++ ] = (byte )(snsz >> 16 );
14371437 buf [len ++ ] = (byte )(snsz >> 8 ); buf [len ++ ] = (byte )snsz ;
1438- WMEMCPY (buf + len , cases [i ].svcName , snsz ); len += snsz ;
1438+ if (snsz > 0 ) { WMEMCPY (buf + len , cases [i ].svcName , snsz ); }
1439+ len += snsz ;
14391440
14401441 /* auth method: omit for invalid-service cases to prove short-circuit */
14411442 if (cases [i ].authMethod != NULL ) {
@@ -1488,6 +1489,14 @@ static int test_DoUserAuthRequest_serviceName(void)
14881489 goto done ;
14891490 }
14901491
1492+ /* Invalid-service cases must NOT record the username. */
1493+ if (cases [i ].authMethod == NULL && ssh -> userName != NULL ) {
1494+ printf ("DoUserAuthRequest_svcName[%s]: userName set on invalid "
1495+ "service (expected NULL)\n" , cases [i ].label );
1496+ result = -530 - i ;
1497+ goto done ;
1498+ }
1499+
14911500 wolfSSH_free (ssh );
14921501 ssh = NULL ;
14931502 }
You can’t perform that action at this time.
0 commit comments