Date: Sun, 7 Sep 2008 22:19:13 +0200 (CEST) From: Joost Bekkers <joost@jodocus.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/127194: [PATCH] arpa/telnet.h: TELOPT(x) returns wrong result / segfaults Message-ID: <200809072019.m87KJDl8082891@jodocus.org> Resent-Message-ID: <200809072040.m87Ke2Gf066885@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 127194 >Category: bin >Synopsis: [PATCH] arpa/telnet.h: TELOPT(x) returns wrong result / segfaults >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Sep 07 20:40:02 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Joost Bekkers >Release: FreeBSD 7.0-RELEASE-p4 amd64 >Organization: >Environment: System: FreeBSD bps.jodocus.org 7.0-RELEASE-p4 FreeBSD 7.0-RELEASE-p4 #3: Wed Sep 3 23:33:23 CEST 2008 joost@bps.jodocus.org:/usr/src/sys/amd64/compile/bps amd64 >Description: The telnet options added to src/contrib/telnet/arpa/telnet.h in rev 1.9 (==RELENG_5_2_0_RELEASE==HEAD) were discontinuous, but names were added to telopts[] without the corresponding gaps. This can cause TELOPT to return pointers outside of telopts[] even though TELOPT_OK returns 'true'. >How-To-Repeat: #include <stdio.h> #define TELOPTS #include <arpa/telnet.h> int main(int argc,char *argv[]) { unsigned int opt; opt=TELOPT_KERMIT; if (TELOPT_OK(opt)) printf("Option name:%s\n",TELOPT(opt)); else printf("Unknown option %d\n",opt); return 0; } depending on your luck, this either tells you the option is "(null)" or segfaults. >Fix: --- telnet.h.org 2008-09-07 21:45:53.000000000 +0200 +++ telnet.h 2008-09-07 22:12:19.000000000 +0200 @@ -140,8 +140,8 @@ "TACACS UID", "OUTPUT MARKING", "TTYLOC", "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", - "ENCRYPT", "NEW-ENVIRON", "TN3270E", "CHARSET", "COM-PORT", - "KERMIT", + "ENCRYPT", "NEW-ENVIRON", "TN3270E", "XAUTH", "CHARSET", + "RSP", "COM-PORT", "SLE", "STARTTLS", "KERMIT", 0 }; #define TELOPT_FIRST TELOPT_BINARY >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809072019.m87KJDl8082891>