CVS: seamlessrdp/ServerExe main.c,1.13,1.14 vchannel.c,1.5,1.6 vchannel.h,1.3,1.4

Pierre Ossman <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/seamlessrdp/ServerExe
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9178/ServerExe

Modified Files:
	main.c vchannel.c vchannel.h 
Log Message:
Add filtering of dangerous characters in strings that are part of the
protocol.


Index: main.c
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/main.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** main.c	10 Mar 2006 16:14:37 -0000	1.13
--- main.c	10 Mar 2006 16:40:55 -0000	1.14
***************
*** 101,107 ****
  	GetWindowText(hwnd, title, sizeof(title));
  
! 	/* FIXME: Strip title of dangerous characters */
! 
! 	vchannel_write("TITLE,0x%x,%s,0x%x", hwnd, title, 0);
  
  	if (styles & WS_MAXIMIZE)
--- 101,105 ----
  	GetWindowText(hwnd, title, sizeof(title));
  
! 	vchannel_write("TITLE,0x%x,%s,0x%x", hwnd, vchannel_strfilter(title), 0);
  
  	if (styles & WS_MAXIMIZE)

Index: vchannel.c
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/vchannel.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** vchannel.c	10 Mar 2006 09:12:36 -0000	1.5
--- vchannel.c	10 Mar 2006 16:40:56 -0000	1.6
***************
*** 33,36 ****
--- 33,39 ----
  #define CHANNELNAME "seamrdp"
  
+ #define INVALID_CHARS ","
+ #define REPLACEMENT_CHAR '_'
+ 
  static HANDLE g_mutex = NULL;
  static HANDLE g_vchannel = NULL;
***************
*** 48,51 ****
--- 51,56 ----
  	va_end(argp);
  
+ 	vchannel_strfilter(buf + sizeof("DEBUG,"));
+ 
  	vchannel_write(buf);
  }
***************
*** 203,204 ****
--- 208,223 ----
  	ReleaseMutex(g_mutex);
  }
+ 
+ const char *
+ vchannel_strfilter(char *string)
+ {
+ 	char *c;
+ 
+ 	for (c = string; *c != '\0'; c++)
+ 	{
+ 		if ((*c < 0x20) || (strchr(INVALID_CHARS, *c) != NULL))
+ 			*c = REPLACEMENT_CHAR;
+ 	}
+ 
+ 	return string;
+ }

Index: vchannel.h
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/vchannel.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** vchannel.h	9 Mar 2006 15:14:53 -0000	1.3
--- vchannel.h	10 Mar 2006 16:40:56 -0000	1.4
***************
*** 39,41 ****
--- 39,43 ----
  void vchannel_unblock();
  
+ const char *vchannel_strfilter(char *string);
+ 
  #endif



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.