Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 585696 | Differences between
and this patch

Collapse All | Expand All

(-)screen-4.3.1.orig/attacher.c (-2 / +2 lines)
Lines 364-371 Link Here
364
    }
364
    }
365
#endif
365
#endif
366
  ASSERT(how == MSG_ATTACH || how == MSG_CONT);
366
  ASSERT(how == MSG_ATTACH || how == MSG_CONT);
367
  strncpy(m.m.attach.envterm, attach_term, sizeof(m.m.attach.envterm) - 1);
367
  strncpy(m.m.attach.envterm, attach_term, MAXTERMLEN);
368
  m.m.attach.envterm[sizeof(m.m.attach.envterm) - 1] = 0;
368
  m.m.attach.envterm[MAXTERMLEN] = 0;
369
  debug1("attach: sending %d bytes... ", (int)sizeof(m));
369
  debug1("attach: sending %d bytes... ", (int)sizeof(m));
370
370
371
  strncpy(m.m.attach.auser, LoginName, sizeof(m.m.attach.auser) - 1); 
371
  strncpy(m.m.attach.auser, LoginName, sizeof(m.m.attach.auser) - 1); 
(-)screen-4.3.1.orig/display.c (-4 / +4 lines)
Lines 309-316 Link Here
309
309
310
  strncpy(D_usertty, utty, sizeof(D_usertty) - 1);
310
  strncpy(D_usertty, utty, sizeof(D_usertty) - 1);
311
  D_usertty[sizeof(D_usertty) - 1] = 0;
311
  D_usertty[sizeof(D_usertty) - 1] = 0;
312
  strncpy(D_termname, term, sizeof(D_termname) - 1);
312
  strncpy(D_termname, term, MAXTERMLEN);
313
  D_termname[sizeof(D_termname) - 1] = 0;
313
  D_termname[MAXTERMLEN] = 0;
314
  D_user = *u;
314
  D_user = *u;
315
  D_processinput = ProcessInput;
315
  D_processinput = ProcessInput;
316
  D_mousetrack = defmousetrack;
316
  D_mousetrack = defmousetrack;
Lines 3725-3738 Link Here
3725
  char *m;
3725
  char *m;
3726
  int pid;
3726
  int pid;
3727
  int slave = -1;
3727
  int slave = -1;
3728
  char termname[30];
3728
  char termname[MAXTERMLEN + 6];
3729
#ifndef TIOCSWINSZ
3729
#ifndef TIOCSWINSZ
3730
  char libuf[20], cobuf[20];
3730
  char libuf[20], cobuf[20];
3731
#endif
3731
#endif
3732
  char **np;
3732
  char **np;
3733
3733
3734
  strcpy(termname, "TERM=");
3734
  strcpy(termname, "TERM=");
3735
  strncpy(termname + 5, D_termname, sizeof(termname) - 6);
3735
  strncpy(termname + 5, D_termname, MAXTERMLEN - 6);
3736
  termname[sizeof(termname) - 1] = 0;
3736
  termname[sizeof(termname) - 1] = 0;
3737
  KillBlanker();
3737
  KillBlanker();
3738
  D_blankerpid = -1;
3738
  D_blankerpid = -1;
(-)screen-4.3.1.orig/process.c (-2 / +3 lines)
Lines 2672-2684 Link Here
2672
      s = NULL;
2672
      s = NULL;
2673
      if (ParseSaveStr(act, &s))
2673
      if (ParseSaveStr(act, &s))
2674
	break;
2674
	break;
2675
      if (strlen(s) >= MAXTERMLEN)
2675
      if (strlen(s) > MAXTERMLEN)
2676
	{
2676
	{
2677
	  OutputMsg(0, "%s: term: argument too long ( < %d)", rc_name, MAXTERMLEN);
2677
	  OutputMsg(0, "%s: term: argument too long ( < %d)", rc_name, MAXTERMLEN);
2678
	  free(s);
2678
	  free(s);
2679
	  break;
2679
	  break;
2680
	}
2680
	}
2681
      strcpy(screenterm, s);
2681
      strncpy(screenterm, s, MAXTERMLEN);
2682
      screenterm[MAXTERMLEN] = '\0';
2682
      free(s);
2683
      free(s);
2683
      debug1("screenterm set to %s\n", screenterm);
2684
      debug1("screenterm set to %s\n", screenterm);
2684
      MakeTermcap((display == 0));
2685
      MakeTermcap((display == 0));
(-)screen-4.3.1.orig/screen.c (-4 / +7 lines)
Lines 507-513 Link Here
507
#endif
507
#endif
508
  nwin = nwin_undef;
508
  nwin = nwin_undef;
509
  nwin_options = nwin_undef;
509
  nwin_options = nwin_undef;
510
  strcpy(screenterm, "screen");
510
  strncpy(screenterm, "screen", MAXTERMLEN);
511
  screenterm[MAXTERMLEN] = '\0';
511
#ifdef BUILTIN_TELNET
512
#ifdef BUILTIN_TELNET
512
  af = AF_UNSPEC;
513
  af = AF_UNSPEC;
513
#endif
514
#endif
Lines 689-696 Link Here
689
		case 'T':
690
		case 'T':
690
		  if (--ac == 0)
691
		  if (--ac == 0)
691
		    exit_with_usage(myname, "Specify terminal-type with -T", NULL);
692
		    exit_with_usage(myname, "Specify terminal-type with -T", NULL);
692
		  if (strlen(*++av) < 20)
693
		  if (strlen(*++av) < MAXTERMLEN) {
693
		    strcpy(screenterm, *av);
694
		    strncpy(screenterm, *av, MAXTERMLEN);
695
            screenterm[MAXTERMLEN] = '\0';
696
          }
694
		  else
697
		  else
695
		    Panic(0, "-T: terminal name too long. (max. 20 char)");
698
		    Panic(0, "-T: terminal name too long. (max. 20 char)");
696
		  nwin_options.term = screenterm;
699
		  nwin_options.term = screenterm;
Lines 1034-1040 Link Here
1034
1037
1035
      if ((attach_term = getenv("TERM")) == 0 || *attach_term == 0)
1038
      if ((attach_term = getenv("TERM")) == 0 || *attach_term == 0)
1036
	Panic(0, "Please set a terminal type.");
1039
	Panic(0, "Please set a terminal type.");
1037
      if (strlen(attach_term) > sizeof(D_termname) - 1)
1040
      if (strlen(attach_term) > MAXTERMLEN)
1038
	Panic(0, "$TERM too long - sorry.");
1041
	Panic(0, "$TERM too long - sorry.");
1039
      GetTTY(0, &attach_Mode);
1042
      GetTTY(0, &attach_Mode);
1040
#ifdef DEBUGGGGGGGGGGGGGGG
1043
#ifdef DEBUGGGGGGGGGGGGGGG
(-)screen-4.3.1.orig/screen.h (-1 / +1 lines)
Lines 204-210 Link Here
204
	  int nargs;
204
	  int nargs;
205
	  char line[MAXPATHLEN];
205
	  char line[MAXPATHLEN];
206
	  char dir[MAXPATHLEN];
206
	  char dir[MAXPATHLEN];
207
	  char screenterm[MAXTERMLEN];	/* is screen really "screen" ? */
207
	  char screenterm[MAXTERMLEN + 1];	/* is screen really "screen" ? */
208
	}
208
	}
209
      create;
209
      create;
210
      struct
210
      struct
(-)screen-4.3.1.orig/socket.c (-2 / +2 lines)
Lines 695-702 Link Here
695
      return;
695
      return;
696
    }
696
    }
697
  if (nwin->term != nwin_undef.term)
697
  if (nwin->term != nwin_undef.term)
698
    strncpy(m.m.create.screenterm, nwin->term, 19);
698
    strncpy(m.m.create.screenterm, nwin->term, MAXTERMLEN);
699
  m.m.create.screenterm[19] = '\0';
699
  m.m.create.screenterm[MAXTERMLEN] = '\0';
700
  m.protocol_revision = MSG_REVISION;
700
  m.protocol_revision = MSG_REVISION;
701
  debug1("SendCreateMsg writing '%s'\n", m.m.create.line);
701
  debug1("SendCreateMsg writing '%s'\n", m.m.create.line);
702
  if (write(s, (char *) &m, sizeof m) != sizeof m)
702
  if (write(s, (char *) &m, sizeof m) != sizeof m)
(-)screen-4.3.1.orig/termcap.c (-2 / +3 lines)
Lines 72-78 Link Here
72
static int Termcaplen;
72
static int Termcaplen;
73
static int tcLineLen;
73
static int tcLineLen;
74
char Term[MAXSTR+5];		/* +5: "TERM=" */
74
char Term[MAXSTR+5];		/* +5: "TERM=" */
75
char screenterm[20];		/* new $TERM, usually "screen" */
75
char screenterm[MAXTERMLEN + 1];    /* new $TERM, usually "screen" */
76
76
77
char *extra_incap, *extra_outcap;
77
char *extra_incap, *extra_outcap;
78
78
Lines 883-889 Link Here
883
  if (*screenterm == '\0' || strlen(screenterm) > MAXSTR - 3)
883
  if (*screenterm == '\0' || strlen(screenterm) > MAXSTR - 3)
884
    {
884
    {
885
      debug("MakeTermcap sets screenterm=screen\n");
885
      debug("MakeTermcap sets screenterm=screen\n");
886
      strcpy(screenterm, "screen");
886
      strncpy(screenterm, "screen", MAXTERMLEN);
887
      screenterm[MAXTERMLEN] = '\0';
887
    }
888
    }
888
#if 0
889
#if 0
889
  found = 1;
890
  found = 1;
(-)screen-4.3.1.orig/window.c (-1 / +1 lines)
Lines 1438-1444 Link Here
1438
      NewEnv[4] = shellbuf;
1438
      NewEnv[4] = shellbuf;
1439
      debug1("ForkWindow: NewEnv[4] = '%s'\n", shellbuf);
1439
      debug1("ForkWindow: NewEnv[4] = '%s'\n", shellbuf);
1440
      if (win->w_term && *win->w_term && strcmp(screenterm, win->w_term) &&
1440
      if (win->w_term && *win->w_term && strcmp(screenterm, win->w_term) &&
1441
	  (strlen(win->w_term) < 20))
1441
	  (strlen(win->w_term) < MAXTERMLEN))
1442
	{
1442
	{
1443
	  char *s1, *s2, tl;
1443
	  char *s1, *s2, tl;
1444
1444

Return to bug 585696