#12282: Fix strcmp() will NULL argument in termcap library
------------------------+---------------------------------------------------
Reporter: jdemeyer | Owner: tbd
Type: defect | Status: needs_review
Priority: blocker | Milestone: sage-4.8
Component: packages | Keywords: sd35.5
Work_issues: | Upstream: Not yet reported upstream; Will do
shortly.
Reviewer: | Author: Jeroen Demeyer
Merged: | Dependencies:
------------------------+---------------------------------------------------
Changes (by newvalueoldvalue):
* status: needs_info => needs_review
* author: => Jeroen Demeyer
Old description:
> If the environment variable `TERMCAP` is set and `TERM` is not set, then
> calling `tgetent()` from the termcap library produces a Segmentation
> Fault because it calls `strcmp()` with a NULL argument.
New description:
If the environment variable `TERMCAP` is set and `TERM` is not set, then
calling `tgetent()` from the termcap library produces a Segmentation Fault
because it calls `strcmp()` with a NULL argument.
To reproduce this issue: let `tgetent_test.c` be the file
{{{
#include <termcap.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char** argv)
{
char* buf = malloc(100000);
tgetent(buf, "dumb");
printf("Successful!\n");
}
}}}
Now compile and link this with Sage's `libtermcap.a` (don't use
`-ltermcap`, instead explicitly specify the path to the `libtermcap.a`
file):
{{{
$ gcc tgetent_test.c local/lib/libtermcap.a -o tgetent_test
}}}
Run this with `TERMCAP` set but `TERM` unset:
{{{
$ unset TERM
$ export TERMCAP="x"
$ ./tgetent_test
Segmentation fault
}}}
'''Apply''':
[http://boxen.math.washington.edu/home/jdemeyer/spkg/termcap-1.3.1.p2.spkg]
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12282#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.