Ticket #55493: telnet_telnet.c.patch
File telnet_telnet.c.patch, 1.4 KB (added by jmroot (Joshua Root), 6 years ago) |
---|
-
telnet/telnet.c
old new gettermname (void) 830 830 * Linemode 831 831 */ 832 832 833 /* enough to hold a DISPLAY that could theoretically be up to PATH_MAX long */ 834 #define TEMPBUFSIZE 1024 835 833 836 static void 834 837 suboption (void) 835 838 { … … suboption (void) 848 851 else 849 852 { 850 853 char *name; 851 unsigned char temp[ 50];854 unsigned char temp[TEMPBUFSIZE]; 852 855 int len; 853 856 854 857 #if defined TN3270 … … suboption (void) 859 862 #endif /* defined(TN3270) */ 860 863 name = gettermname (); 861 864 len = strlen (name) + 4 + 2; 862 if (len < NETROOM () )865 if (len < NETROOM () && len < TEMPBUFSIZE-1) 863 866 { 864 867 sprintf ((char *) temp, "%c%c%c%c%s%c%c", IAC, SB, TELOPT_TTYPE, 865 868 TELQUAL_IS, name, IAC, SE); … … suboption (void) 880 883 if (SB_GET () == TELQUAL_SEND) 881 884 { 882 885 long ospeed, ispeed; 883 unsigned char temp[ 50];886 unsigned char temp[TEMPBUFSIZE]; 884 887 int len; 885 888 886 889 TerminalSpeeds (&ispeed, &ospeed); … … suboption (void) 987 990 return; 988 991 if (SB_GET () == TELQUAL_SEND) 989 992 { 990 unsigned char temp[ 50], *dp;993 unsigned char temp[TEMPBUFSIZE], *dp; 991 994 int len; 992 995 993 if ((dp = env_getvalue ("DISPLAY")) == NULL )996 if ((dp = env_getvalue ("DISPLAY")) == NULL || strlen(dp) >= TEMPBUFSIZE) 994 997 { 995 998 /* 996 999 * Something happened, we no longer have a DISPLAY