mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-15 16:11:01 +00:00
set minimum key size
This commit is contained in:
parent
6be15f9c67
commit
8c2e4d44ce
1 changed files with 7 additions and 1 deletions
|
@ -87,6 +87,8 @@ getkey(NSString **key)
|
|||
char *one = NULL;
|
||||
char *two = NULL;
|
||||
|
||||
#define MINKEY 16
|
||||
|
||||
/* Open the terminal
|
||||
*/
|
||||
if ((stream = fopen("/dev/tty", "r+")) == NULL)
|
||||
|
@ -113,7 +115,7 @@ getkey(NSString **key)
|
|||
int olen = 0;
|
||||
int tlen = 0;
|
||||
|
||||
while (0 == olen)
|
||||
while (olen < MINKEY)
|
||||
{
|
||||
size_t len = 0;
|
||||
|
||||
|
@ -127,6 +129,10 @@ getkey(NSString **key)
|
|||
return NO;
|
||||
}
|
||||
olen = trim(one);
|
||||
if (olen < MINKEY)
|
||||
{
|
||||
fprintf(stream, "\nKey must be at least %u characters\n", MINKEY);
|
||||
}
|
||||
}
|
||||
|
||||
while (0 == tlen)
|
||||
|
|
Loading…
Reference in a new issue