mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-16 01:27:08 +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,
|
Narrat, Jerry Polfer, Jim Turner, Maxime Arthaud, RobertMX,
|
||||||
mhogomchungu Mandeep Bhutani, Emil Lundberg, Joel Montes de Oca, Armin
|
mhogomchungu Mandeep Bhutani, Emil Lundberg, Joel Montes de Oca, Armin
|
||||||
Mesbah, Arusekk, Stephan Schindel, Asbjørn Apeland, Victor Calvert,
|
Mesbah, Arusekk, Stephan Schindel, Asbjørn Apeland, Victor Calvert,
|
||||||
bjonnh, SargoDevel, AitorATuin, Alexis Danizan and... the Linux
|
bjonnh, SargoDevel, AitorATuin, Alexis Danizan, Sven Geuer and...
|
||||||
Action Show!
|
the Linux Action Show!
|
||||||
|
|
||||||
Tomb includes an implementation of the "Password-Based Key Derivation
|
Tomb includes an implementation of the "Password-Based Key Derivation
|
||||||
Function v2" based on GCrypt and written by Anthony Thyssen, with
|
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
|
* passwords containing just a bunch of spaces are valid
|
||||||
*/
|
*/
|
||||||
pass = calloc(buff_len, sizeof(char));
|
pass = calloc(buff_len, sizeof(char));
|
||||||
char c = getchar();
|
int c = getchar();
|
||||||
while (c != EOF) {
|
while (c != EOF) {
|
||||||
if (pw_len == buff_len) {
|
if (pw_len == buff_len) {
|
||||||
buff_len *= 2;
|
buff_len *= 2;
|
||||||
pass = realloc(pass, buff_len);
|
pass = realloc(pass, buff_len);
|
||||||
if (!pass) {
|
if (!pass) {
|
||||||
fprintf(stderr, "Error allocating memory");
|
fprintf(stderr, "Error allocating memory\n");
|
||||||
cleanup(result, result_len, pass, salt, salt_len);
|
cleanup(result, result_len, pass, salt, salt_len);
|
||||||
exit(3);
|
exit(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pass[pw_len] = c;
|
pass[pw_len] = (char)c;
|
||||||
pw_len++;
|
pw_len++;
|
||||||
c = getchar();
|
c = getchar();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user