mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-12-22 10:08:58 +00:00
Fix tomb-kdb-pbkdf2 helper for multiplatform build
Avoid EOF being missed when reading in the password. Replace undefined char-to-int comparison with a int-to-int one. Fix #360
This commit is contained in:
parent
6f2ce59d29
commit
187a627022
@ -28,8 +28,8 @@ The Grugq, Reiven, GDrooid, Alphazo, Brian May, fsLeg, JoelMon,
|
||||
Narrat, Jerry Polfer, Jim Turner, Maxime Arthaud, RobertMX,
|
||||
mhogomchungu Mandeep Bhutani, Emil Lundberg, Joel Montes de Oca, Armin
|
||||
Mesbah, Arusekk, Stephan Schindel, Asbjørn Apeland, Victor Calvert,
|
||||
bjonnh, SargoDevel, AitorATuin, Alexis Danizan and... the Linux
|
||||
Action Show!
|
||||
bjonnh, SargoDevel, AitorATuin, Alexis Danizan, Sven Geuer and...
|
||||
the Linux Action Show!
|
||||
|
||||
Tomb includes an implementation of the "Password-Based Key Derivation
|
||||
Function v2" based on GCrypt and written by Anthony Thyssen, with
|
||||
|
@ -140,18 +140,18 @@ int main(int argc, char *argv[])
|
||||
* passwords containing just a bunch of spaces are valid
|
||||
*/
|
||||
pass = calloc(buff_len, sizeof(char));
|
||||
char c = getchar();
|
||||
int c = getchar();
|
||||
while (c != EOF) {
|
||||
if (pw_len == buff_len) {
|
||||
buff_len *= 2;
|
||||
pass = realloc(pass, buff_len);
|
||||
if (!pass) {
|
||||
fprintf(stderr, "Error allocating memory");
|
||||
fprintf(stderr, "Error allocating memory\n");
|
||||
cleanup(result, result_len, pass, salt, salt_len);
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
pass[pw_len] = c;
|
||||
pass[pw_len] = (char)c;
|
||||
pw_len++;
|
||||
c = getchar();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user