bin/multiuser: Fix PVS 1809 and 1896
Replace memset() with explicit_bzero(), since compiler could delete memset() funnction call. Change-Id: I6d6ad991951f516cf94b6fdf1772715ef4a42822 Reviewed-on: https://review.haiku-os.org/c/880 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
2876fb7c18
commit
ef916ff3b5
@ -6,14 +6,16 @@ UsePrivateHeaders kernel ;
|
||||
# for <util/KMessage.h>
|
||||
UsePrivateHeaders libroot ;
|
||||
UsePrivateHeaders shared ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ;
|
||||
SubDirC++Flags [ FDefines _BSD_SOURCE=1 ] ;
|
||||
|
||||
StaticLibrary libmultiuser_utils.a : multiuser_utils.cpp ;
|
||||
|
||||
BinCommand login : login.cpp : libmultiuser_utils.a ;
|
||||
BinCommand login : login.cpp : libmultiuser_utils.a libbsd.so ;
|
||||
|
||||
BinCommand su : su.cpp : libmultiuser_utils.a ;
|
||||
BinCommand su : su.cpp : libmultiuser_utils.a libbsd.so ;
|
||||
|
||||
BinCommand passwd : passwd.cpp : libmultiuser_utils.a ;
|
||||
BinCommand passwd : passwd.cpp : libmultiuser_utils.a libbsd.so ;
|
||||
|
||||
BinCommand useradd : useradd.cpp ;
|
||||
|
||||
|
@ -91,7 +91,7 @@ login(const char* user, struct passwd** _passwd)
|
||||
struct spwd* spwd = getspnam(user);
|
||||
|
||||
bool ok = verify_password(passwd, spwd, password);
|
||||
memset(password, 0, sizeof(password));
|
||||
explicit_bzero(password, sizeof(password));
|
||||
|
||||
if (!ok)
|
||||
return B_PERMISSION_DENIED;
|
||||
|
@ -140,7 +140,7 @@ authenticate_user(const char* prompt, passwd* passwd, spwd* spwd, int maxTries,
|
||||
|
||||
// check it
|
||||
bool ok = verify_password(passwd, spwd, plainPassword);
|
||||
memset(plainPassword, 0, sizeof(plainPassword));
|
||||
explicit_bzero(plainPassword, sizeof(plainPassword));
|
||||
if (ok)
|
||||
return B_OK;
|
||||
|
||||
|
@ -169,11 +169,11 @@ main(int argc, const char* const* argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memset(repeatedPassword, 0, sizeof(repeatedPassword));
|
||||
explicit_bzero(repeatedPassword, sizeof(repeatedPassword));
|
||||
|
||||
// crypt it
|
||||
encryptedPassword = crypt(password, NULL);
|
||||
memset(password, 0, sizeof(password));
|
||||
explicit_bzero(password, sizeof(password));
|
||||
}
|
||||
|
||||
// prepare request for the registrar
|
||||
|
Loading…
Reference in New Issue
Block a user