mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-08-01 20:56:21 +00:00
Safe string handling on get password
This commit is contained in:
@@ -30,8 +30,8 @@ int handle_start_command(char *inp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// trim input and take a copy
|
// trim input and take a copy
|
||||||
char inp_cpy[100];
|
|
||||||
inp = trim(inp);
|
inp = trim(inp);
|
||||||
|
char inp_cpy[strlen(inp) + 1];
|
||||||
strcpy(inp_cpy, inp);
|
strcpy(inp_cpy, inp);
|
||||||
|
|
||||||
// get the command "/command"
|
// get the command "/command"
|
||||||
@@ -70,8 +70,8 @@ int handle_command(char *inp)
|
|||||||
if (inp[0] == '/') {
|
if (inp[0] == '/') {
|
||||||
|
|
||||||
// trim input and take a copy
|
// trim input and take a copy
|
||||||
char inp_cpy[100];
|
|
||||||
inp = trim(inp);
|
inp = trim(inp);
|
||||||
|
char inp_cpy[strlen(inp) + 1];
|
||||||
strcpy(inp_cpy, inp);
|
strcpy(inp_cpy, inp);
|
||||||
|
|
||||||
// get the command "/command"
|
// get the command "/command"
|
||||||
@@ -131,7 +131,7 @@ static int _cmd_start_connect(char *inp)
|
|||||||
|
|
||||||
status_bar_get_password();
|
status_bar_get_password();
|
||||||
status_bar_refresh();
|
status_bar_refresh();
|
||||||
char passwd[20];
|
char passwd[21];
|
||||||
inp_get_password(passwd);
|
inp_get_password(passwd);
|
||||||
int connect_status = jabber_connect(user, passwd);
|
int connect_status = jabber_connect(user, passwd);
|
||||||
if (connect_status == CONNECTING)
|
if (connect_status == CONNECTING)
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ void inp_get_password(char *passwd)
|
|||||||
{
|
{
|
||||||
wclear(inp_win);
|
wclear(inp_win);
|
||||||
noecho();
|
noecho();
|
||||||
mvwgetstr(inp_win, 0, 1, passwd);
|
mvwgetnstr(inp_win, 0, 1, passwd, 20);
|
||||||
wmove(inp_win, 0, 1);
|
wmove(inp_win, 0, 1);
|
||||||
echo();
|
echo();
|
||||||
status_bar_clear();
|
status_bar_clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user