A cross-reference was intended to be placed inside parentheses,
but the closing parenthesis was forgotten; this commit inserts
that missing closing parenthesis.
Commit 7059bff expands index range of "typ2" by one without expanding
affected arrays. d_xtermosc in struct display is one of these.
Related: 7059bff20a
(ansi: add support for xterm OSC 11)
Related: eb2be1adf9
(Fix out of bounds access when setting w_xtermosc after OSC 49)
Signed-off-by: Václav Doležal <vdolezal@redhat.com>
echo -e "\e]49\e; \n\ec"
crashes screen.
This happens because 49 is divided by 10 and used as table index
resulting in access to w_xtermosc[4], which is out of bounds with table
itself being size 4. Increase size of table by 1 to 5, which is enough
for all current uses.
As this overwrites memory based on user input it is potential security
issue.
Reported-by: pippin@gimp.org
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
If there is no event timeout set just wait for 1 second instead of
setting poll timeout to 0.
Bug: 57697
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
* src/tests/test-winmsgbuf.c (main): Replace alloca with malloc/free
to prevent the following warning: tests/test-winmsgbuf.c:298:19:\
warning: implicit declaration of function ‘alloca’; did you mean \
‘calloc’?
* src/tests/test-winmsgbuf.c:45: make char * const
This avoids the following warning:
tests/test-winmsgbuf.c:45:17: warning: initialization of\
‘char *[...]'from incompatible pointer type ‘const char *[...]'
If wmc_else() is called after wmb_expand() it can overwrite pointer to
old value. To avoid this issue refactor condition code to use offset
into parsed string instead.
Reported-by: pippin@gimp.org
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
ParseAttrColor returns uint64_t and ApplyAttrColor takes uint64_t as
argument, int was used instead, which may cause vertical bar to not have
color applied on split.
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
When opening a TTY we enable exclusive mode to prevent other tools
messing with our connection. When we are done using the TTY the
exclusive mode must be disabled so the TTY can be reconnected to
later. We remember to do this when a break is sent to the device,
but not on window close.
This change ensures we disable exclusive mode on the TTY device
whenever the window is closed.
bug #52248
TERMCAP_BUF defaults to 1023 to create TERMCAP entries that work on
most systems. To save space, TERMCAP is unwrapped, and vt220 extra
keys are skipped (unless TERMCAP_BUF > 1023); navigation keys are
still included. Entries larger than TERMCAP_BUF are now truncated,
and no longer Panic screen.
Termcap entries are still wrapped when saved to a file.
Signed-off-by: Scott Shambarger <devel@shambarger.net>
Here's the rub: with TERM=xterm (or rxvt, for that matter), Km
("key_mouse", "Mouse event has occured") is not set (and therefore
NULL), but InitTermcap() (termcap.c:230) happily tries to strdup() that,
which gets us that segfault.
As a band-aid, catch that NULL and don't strdup().
Signed-off-by: Marcin Cieślak <saper@saper.info>
select() limits number of file descriptors that can be used by screen.
Migrate to poll() to avoid this limitation.
As can be seen in case of scheduler it requires quite some changes, care
must be taken to count poll() events properly.
Bug: 55697
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
select() limits number of file descriptors that can be used by screen.
Migrate to poll() to avoid this limitation.
Bug: 55697
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
select() limits number of file descriptors that can be used by screen.
Migrate to poll() to avoid this limitation.
Bug: 55697
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Optimize startup time, making closeallfiles() faster, by doing less
system calls. Instead of calling close for each possible file, use
poll() to check if file exist at all. On linux with open file limit set
to 1048576, it should do 1024 poll() calls instead of 1048576 close().
Bug: 55618
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
ncurses 6.1 changed kmous capability from "\e[M" to "\e[<". It seems to
be done to signal that terminal supports sgr mouse mode. screen assumed
that if kmous is set to "\e[M" it is on xterm compatible terminal
anyway, so just dynamically detect which one is used and override
relevant kmapdef.
InitKeytab() is moved, so kmapdef[] can be overriden before
initialization, as InitTermcap() needs to run first, as far as I can
tell this should have no consequences.
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Shouldn't have really used strncpy, for something that is effectively
binary data.
Also cleanup structs when defining instead of adding memsets everywhere.
This reverts commit ceb9b1f6ec.
I need to look at this again, there is a report that commit in question
may cause problems and apparently logic may have failed me when I
removed this code, as it probably should stay and everything after it is
unreacheable.
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Fixes problem when pressing arrows in some prompts causes arrows to stop
in other places.
For example pressing up arrow in 'kill --confirm' prompt stops up arrow
from working on 'windowlist'
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Breaks backward compatibility
This fixes a problem when user runs screen with "-L" option in already
existing screen. We need to pass information about theflag to backend.
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
We don't know format of data we pass around, so we may as well define
pointer as void *. Gets rid of -Wcast-align warning with clang.
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Define d_processinputdata as struct pwdata instead of doing casts back
and forth. Removes clang warning with -Wcast-align.
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Characters are stored as uint32 nowadays. Looking at the lower bytes
only seems to be an oversight from the fontx clean up.
Fixes: f18f5d0da1 get rid of fontx
there is no BEL in enable/disable bracketed paste mode sequence, so we
shouldn't unnecessarily print it
Bug: #55709
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
This closes bug #52372: Giberish printed to screen window in certain
situations.
When sending "^An", most of the time, screen first receives "^A", then
it receives the "n". This means that in the ProcessInput2 function,
ilen == 1 after the escape character has been seen, ilen is decremented
and the ProcessInput2 function returns.
When "^An" is sent in one go, for example when pasting or when using a
special shortcut, ilen is not 1 when the escape character is seen. In
this case, the s variable was incremented, but ilen was not decremented.
This leads the function to read an extra character which does not
exists.
This regression was introduced in 2fab4d6f73, as reported in the bug
report.
This can be tested by having a command in the selection:
echo -ne '\x01n' | xclip -i
And pasting it (in this case, you might see the closing bracketed paste
sequence, but that is another problem).
Bug: #52372
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>