Package: screen
Version: 4.0.3-0.3+b1
Severity: minor

If I set a variable (incorrectly) with no value in ~/.screenrc and try
to start screen with "screen -m -d" or "screen -m -D", screen produces
a segfault.

Steps to reproduce:

$ echo 'setenv FOO'>~/.screenrc
$ screen -m -D
Segmentation fault

Alternatively, screen -m -d produces a segfault too, but this one gets
logged in syslog/dmesg:

screen[17465]: segfault at 4 ip 0806b8bb sp bfe461a0 error 4 in 
screen[8048000+47000]

Expected behavior:

At least not to segfault. If setenv is set interactively under screen,
the user is prompted for a value and if no value is given, then
nothing is done. So when the option is given in a configuration file
screen should either ignore the incorrect ~/.screenrc setenv setting
completely or give an error message.

Versions:

This bug is present both in the stable 4.0.3-0.3+b1 and unstable
4.0.3-11.

I attached a GDB backtrace of the segfault.

-- 
Timo Lilja
GDB trace:

screen-4.0.3$ gdb screen
GNU gdb 6.4.90-debian
[...]
(gdb) run -m -D
Starting program: screen-4.0.3/screen -m -D

Program received signal SIGSEGV, Segmentation fault.
0x08072bc9 in Input (istr=0x80a35e0 "Enter value for FOO: ", len=30,
mode=0, 
    finfunc=0x8082751 <SetenvFin2>, data=0x0) at input.c:123
123           maxlen = flayer->l_width - 1 - strlen(istr);
(gdb) p flayer
$1 = (struct layer *) 0x0
(gdb) bt
#0  0x08072bc9 in Input (istr=0x80a35e0 "Enter value for FOO: ",
len=30, 
    mode=0, finfunc=0x8082751 <SetenvFin2>, data=0x0) at input.c:123
#1  0x080827f1 in InputSetenv (arg=0xbff0cc43 "FOO") at process.c:5163
#2  0x0807c89a in DoAction (act=0xbff0c9ec, key=-1) at process.c:2898
#3  0x0807f9b6 in DoCommand (argv=0xbff0cb18, argl=0xbff0ca18)
    at process.c:3853
#4  0x0805a98c in RcLine (ubuf=0xbff0cc3c "setenv", ubufl=2048) at
fileio.c:339
#5  0x0805a824 in FinishRc (rcfilename=0x0) at fileio.c:284
#6  0x0804ca53 in main (ac=0, av=0xbff0e8b0) at screen.c:1321

Reply via email to