Fix crash and latest update.
This commit is contained in:
+13
-1
@@ -48,6 +48,8 @@ static int WIN32_rename(const char *from, const char *to);
|
||||
# define rename(from,to) WIN32_rename((from),(to))
|
||||
#endif
|
||||
|
||||
#define PASS_SOURCE_SIZE_MAX 4
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
unsigned long flag;
|
||||
@@ -205,6 +207,7 @@ static char *app_get_pass(const char *arg, int keepbio)
|
||||
char *tmp, tpass[APP_PASS_LEN];
|
||||
int i;
|
||||
|
||||
/* PASS_SOURCE_SIZE_MAX = max number of chars before ':' in below strings */
|
||||
if (strncmp(arg, "pass:", 5) == 0)
|
||||
return OPENSSL_strdup(arg + 5);
|
||||
if (strncmp(arg, "env:", 4) == 0) {
|
||||
@@ -253,7 +256,16 @@ static char *app_get_pass(const char *arg, int keepbio)
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
BIO_printf(bio_err, "Invalid password argument \"%s\"\n", arg);
|
||||
/* argument syntax error; do not reveal too much about arg */
|
||||
tmp = strchr(arg, ':');
|
||||
if (tmp == NULL || tmp - arg > PASS_SOURCE_SIZE_MAX)
|
||||
BIO_printf(bio_err,
|
||||
"Invalid password argument, missing ':' within the first %d chars\n",
|
||||
PASS_SOURCE_SIZE_MAX + 1);
|
||||
else
|
||||
BIO_printf(bio_err,
|
||||
"Invalid password argument, starting with \"%.*s\"\n",
|
||||
(int)(tmp - arg + 1), arg);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user