Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

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.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants