File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -292,6 +292,7 @@ static int CheckPasswordHashUnix(const char* input, char* stored)
292292{
293293 int ret = WSSHD_AUTH_SUCCESS ;
294294 char * hashedInput ;
295+ word32 hashedInputSz = 0 , storedSz = 0 ;
295296
296297 if (input == NULL || stored == NULL ) {
297298 ret = WS_BAD_ARGUMENT ;
@@ -303,7 +304,13 @@ static int CheckPasswordHashUnix(const char* input, char* stored)
303304 ret = WS_FATAL_ERROR ;
304305 }
305306 else {
306- if (WMEMCMP (hashedInput , stored , WSTRLEN (stored )) != 0 ) {
307+ hashedInputSz = (word32 )WSTRLEN (hashedInput );
308+ storedSz = (word32 )WSTRLEN (stored );
309+
310+ if (storedSz == 0 || stored [0 ] == '*' ||
311+ hashedInputSz == 0 || hashedInput [0 ] == '*' ||
312+ hashedInputSz != storedSz ||
313+ WMEMCMP (hashedInput , stored , storedSz ) != 0 ) {
307314 ret = WSSHD_AUTH_FAILURE ;
308315 }
309316 }
You can’t perform that action at this time.
0 commit comments