Skip to content

Commit 4076b82

Browse files
committed
loader.c: Use our ishex() instead of strspn(3) in PWDUMP detection
This is to have predictably low performance impact of these checks, regardless of what case libc's strspn() is optimized for. See openwall#5328, amends f3a01f5
1 parent b548cd5 commit 4076b82

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/loader.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "dyna_salt.h"
3838
#include "loader.h"
3939
#include "options.h"
40+
#include "common.h"
4041
#include "config.h"
4142
#include "unicode.h"
4243
#include "dynamic.h"
@@ -603,8 +604,8 @@ static int ldr_split_line(char **login, char **ciphertext,
603604
if (SPLFLEN(1) > MAX_CIPHERTEXT_SIZE) {
604605
huge_line = 1;
605606
}
606-
else if ((SPLFLEN(3) == 32 && strspn(fields[3], HEXCHARS_all) == 32) ||
607-
(SPLFLEN(2) == 32 && strspn(fields[2], HEXCHARS_all) == 32)) {
607+
else if ((SPLFLEN(3) == 32 && ishex(fields[3])) ||
608+
(SPLFLEN(2) == 32 && ishex(fields[2]))) {
608609
/* PWDUMP */
609610
/* user:uid:LMhash:NThash:comment:homedir: */
610611
*uid = fields[1];

0 commit comments

Comments
 (0)