Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!sri-spam!mordor!lll-tis!elxsi!marduk!gww From: gww@marduk.UUCP (Gary Winiger) Newsgroups: comp.bugs.4bsd Subject: Cu dereferences null pointers for baud rate. +Fix Message-ID: <524@elxsi.UUCP> Date: Fri, 4-Sep-87 18:20:10 EDT Article-I.D.: elxsi.524 Posted: Fri Sep 4 18:20:10 1987 Date-Received: Sat, 5-Sep-87 21:33:41 EDT Sender: nobody@elxsi.UUCP Reply-To: gww@marduk.UUCP (Gary Winiger) Organization: ELXSI Super Computers, San Jose Lines: 71 Subject: Cu dereferneces null pointers for baud rate. +Fix Index: usr.bin/tip/cu.c 4.3BSD +Fix Description: Cu will dereference null pointers if -s option is passed without a following parameter, or if no baud rate is specified. Repeat-By: By inspection of the code. Fix: The attached code solves this problem at Elxsi. Gary.. {ucbvax!sun,lll-lcc!lll-tis,amdahl!altos86,bridge2}!elxsi!gww --------- cut --------- snip --------- :.,$w diff ------------- *** /tmp/,RCSt1001225 Fri Jul 3 14:59:51 1987 --- cu.c Fri Jul 3 14:59:32 1987 *************** *** 1,5 **** --- 1,8 ---- /* * $Log: cu.c,v $ + * Revision 1.2 87/07/03 14:59:16 gww + * Correct null pointer dereferences. + * * Revision 1.1 87/07/02 17:21:47 gww * Initial revision * *************** *** 11,17 **** */ #ifndef lint ! static char *ERcsId = "$Header: cu.c,v 1.1 87/07/02 17:21:47 gww Exp $ ENIX BSD"; static char sccsid[] = "@(#)cu.c 5.2 (Berkeley) 1/13/86"; #endif not lint --- 14,20 ---- */ #ifndef lint ! static char *ERcsId = "$Header: cu.c,v 1.2 87/07/03 14:59:16 gww Exp $ ENIX BSD"; static char sccsid[] = "@(#)cu.c 5.2 (Berkeley) 1/13/86"; #endif not lint *************** *** 34,39 **** --- 37,43 ---- exit(8); } CU = DV = NOSTR; + BR = DEFBR; for (; argc > 1; argv++, argc--) { if (argv[1][0] != '-') PN = argv[1]; *************** *** 49,55 **** break; case 's': ! if (speed(atoi(argv[2])) == 0) { fprintf(stderr, "cu: unsupported speed %s\n", argv[2]); exit(3); --- 53,59 ---- break; case 's': ! if ((argc < 3) || (speed(atoi(argv[2])) == 0)) { fprintf(stderr, "cu: unsupported speed %s\n", argv[2]); exit(3);