Subject: patch for ntalkd to combat flash.c
To: None <current-users@netbsd.org>
From: matthew green <mrg@mame.mu.oz.au>
List: current-users
Date: 11/28/1994 22:32:50
for those of you who have had problems with being "flash"ed,
here's a patch to ntalkd that will solve this problem.  apply
with "patch < <this file>" in the /usr/src/libexec/ntalkd
directory.

[ this has been send-pr'ed also ]

.mrg.

ps, for those who don't know what flash does, it basically
send's a bogus username in a talk request with nasty chars in
it.  things like vt100 reset, and other nasties to make life
unpleasant.


*** announce.c.orig	Mon Nov 28 21:25:40 1994
--- announce.c	Mon Nov 28 21:30:08 1994
***************
*** 49,54 ****
--- 49,55 ----
  #include <stdio.h>
  #include <string.h>
  #include <paths.h>
+ #include <vis.h>
  
  extern char hostname[];
  
***************
*** 145,151 ****
--- 146,154 ----
  	char big_buf[N_LINES*N_CHARS];
  	char *bptr, *lptr;
  	int i, j, max_size;
+ 	char *vis_user = (char *) malloc((strlen(request->l_name) * 4) + 1);
  
+ 	strvis(vis_user, request->l_name, VIS_CSTYLE);
  	i = 0;
  	max_size = 0;
  	gettimeofday(&clock, &zone);
***************
*** 160,171 ****
  	max_size = max(max_size, sizes[i]);
  	i++;
  	(void)sprintf(line_buf[i], "talk: connection requested by %s@%s.",
! 		request->l_name, remote_machine);
  	sizes[i] = strlen(line_buf[i]);
  	max_size = max(max_size, sizes[i]);
  	i++;
  	(void)sprintf(line_buf[i], "talk: respond with:  talk %s@%s",
! 		request->l_name, remote_machine);
  	sizes[i] = strlen(line_buf[i]);
  	max_size = max(max_size, sizes[i]);
  	i++;
--- 163,175 ----
  	max_size = max(max_size, sizes[i]);
  	i++;
  	(void)sprintf(line_buf[i], "talk: connection requested by %s@%s.",
! 		vis_user, remote_machine);
  	sizes[i] = strlen(line_buf[i]);
  	max_size = max(max_size, sizes[i]);
  	i++;
  	(void)sprintf(line_buf[i], "talk: respond with:  talk %s@%s",
! 		vis_user, remote_machine);
! 	free(vis_user);
  	sizes[i] = strlen(line_buf[i]);
  	max_size = max(max_size, sizes[i]);
  	i++;