diff options
author | Richard M. Stallman <rms@gnu.org> | 2003-08-19 23:47:31 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2003-08-19 23:47:31 +0000 |
commit | 3a06a6d99b0c573779862bd2b8fb7e56e8b16ccb (patch) | |
tree | ecf1d4074600c01efa2e714bd598bd613e609707 /src | |
parent | 5851666e1007460793baf66ec5766dbe5c097e52 (diff) | |
download | emacs-3a06a6d99b0c573779862bd2b8fb7e56e8b16ccb.tar.gz |
(term_init): Use a buffer of size 4096 for tgetent since
FreeBSD returns something longer than 2044. Abort if the end of
the buffer is overwritten.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 9 | ||||
-rw-r--r-- | src/term.c | 19 |
2 files changed, 18 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2d69bcf912b..bdf4541154e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2003-08-19 Gerd Moellmann <gerd@gnu.org> + + * s/freebsd.h [__FreeBSD_version >= 400000]: Define TERMINFO, + use -lncurses. + + * term.c (term_init): Use a buffer of size 4096 for tgetent since + FreeBSD returns something longer than 2044. Abort if the end of + the buffer is overwritten. + 2003-08-19 Miles Bader <miles@gnu.org> * xterm.c (x_term_init): Correctly use result of Ffile_readable_p. diff --git a/src/term.c b/src/term.c index 829f2d88e6b..66232ab204d 100644 --- a/src/term.c +++ b/src/term.c @@ -2159,7 +2159,8 @@ term_init (terminal_type) { char *area; char **address = &area; - char buffer[2044]; + char *buffer = NULL; + const int buffer_size = 4096; register char *p; int status; struct frame *sf = XFRAME (selected_frame); @@ -2171,9 +2172,6 @@ term_init (terminal_type) area = (char *) xmalloc (2044); - if (area == 0) - abort (); - FrameRows = FRAME_LINES (sf); FrameCols = FRAME_COLS (sf); specified_window = FRAME_LINES (sf); @@ -2202,6 +2200,7 @@ term_init (terminal_type) Wcm_clear (); + buffer = (char *) xmalloc (buffer_size); status = tgetent (buffer, terminal_type); if (status < 0) { @@ -2229,13 +2228,11 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", terminal_type); #endif } -#ifdef TERMINFO - area = (char *) xmalloc (2044); -#else - area = (char *) xmalloc (strlen (buffer)); -#endif /* not TERMINFO */ - if (area == 0) + + if (strlen (buffer) >= buffer_size) abort (); + + area = (char *) xmalloc (strlen (buffer)); TS_ins_line = tgetstr ("al", address); TS_ins_multi_lines = tgetstr ("AL", address); @@ -2560,6 +2557,8 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", FRAME_CAN_HAVE_SCROLL_BARS (sf) = 0; FRAME_VERTICAL_SCROLL_BAR_TYPE (sf) = vertical_scroll_bar_none; #endif /* WINDOWSNT */ + + xfree (buffer); } /* VARARGS 1 */ |