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

ncurses behaves strangely on printw("x%s") #149

Open
skylaner opened this issue Apr 10, 2018 · 2 comments
Open

ncurses behaves strangely on printw("x%s") #149

skylaner opened this issue Apr 10, 2018 · 2 comments

Comments

@skylaner
Copy link

This is what gets printed:

xx%s

It should have printed:

x%s
@jeaye
Copy link
Owner

jeaye commented Apr 19, 2018

This is indeed strange! Have you learned any more about the issue?

@AlexArgoAi
Copy link

AlexArgoAi commented Jul 23, 2018

Related to #164 : in printw, the % sign is interpreted as in a format-string; printw expects an extra argument to replace %s with. This argument is not given (because rust doesn't have variadic functions), so this is essentially unsafe as ncurses will just use whichever memory it wants. Apparently printw finds the "x%s" literal you just defined and uses that, but it could just as well segfault or eat your laundry.
The printw method should really at least be marked as unsafe, and probably removed entirely since there's no way to use it properly. You're much better off using addstr instead.

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

3 participants