Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vulnerability report]A Format string vulnerability #20

Open
ppcrab opened this issue May 28, 2021 · 0 comments
Open

[vulnerability report]A Format string vulnerability #20

ppcrab opened this issue May 28, 2021 · 0 comments

Comments

@ppcrab
Copy link

ppcrab commented May 28, 2021

There is something wrong with this line of code
`void Ui::MessageDialog(const std::string &message){
RedrawStatic();

Dot d=BoundingRect(message);

BorderedWindow w(d.y,d.x);
wattrset((WINDOW *)w,COLOR_PAIR(20));
mvwprintw(w,0,0,message.c_str());//format string vulnerability,when you input your name such as 123%253c%11$n
w.RedrawBorder();
wrefresh(w);
PrepareUiGetch();
int ch;
do{
  ch=getch();
}
while(ch!=' ' && ch!=13); //13=return key!=KEY_ENTER, it seems

}`

mvwprintw is not safe。
You should restrict user input to prevent format string vulnerability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant