[PD-cvs] pd/src s_inter.c,1.1.1.3.2.20,1.1.1.3.2.21
Mathieu Bouchard
matju at users.sourceforge.net
Mon Oct 25 17:47:10 CEST 2004
- Previous message: [PD-cvs] pd/src m_class.c,1.1.1.2.2.6,1.1.1.2.2.7
- Next message: [PD-cvs] pd/src m_simd_sse_vc.c,1.1.2.10,1.1.2.11 m_simd_sse_vc.h,1.1.2.9,1.1.2.10 s_inter.c,1.1.1.3.2.21,1.1.1.3.2.22 s_path.c,1.1.1.2.2.5,1.1.1.2.2.6 t_tkcmd.c,1.1.1.4.2.1,1.1.1.4.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16337
Modified Files:
Tag: devel_0_37
s_inter.c
Log Message:
sys_vgui(): fixed buffer overflow
Index: s_inter.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_inter.c,v
retrieving revision 1.1.1.3.2.20
retrieving revision 1.1.1.3.2.21
diff -C2 -d -r1.1.1.3.2.20 -r1.1.1.3.2.21
*** s_inter.c 21 Oct 2004 08:12:13 -0000 1.1.1.3.2.20
--- s_inter.c 25 Oct 2004 15:47:08 -0000 1.1.1.3.2.21
***************
*** 589,608 ****
#endif /* THREADED_GUI */
! /* LATER should do a bounds check -- but how do you get printf to do that?
! See also rtext_senditup() in this regard */
!
void sys_vgui(char *fmt, ...)
{
! int result, i;
char buf[2048];
va_list ap;
-
va_start(ap, fmt);
! vsprintf(buf, fmt, ap);
! sys_gui(buf);
va_end(ap);
}
-
#define FIRSTPORTNUM 5400
--- 589,614 ----
#endif /* THREADED_GUI */
! /* matju's (fixed buffer overflow) */
void sys_vgui(char *fmt, ...)
{
! unsigned n;
char buf[2048];
va_list ap;
va_start(ap, fmt);
! n = vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
+ if (n>=sizeof(buf)) {
+ char *buf2 = (char *)malloc(n+1);
+ fprintf(stderr,"sys_vgui: warning: big packet: %d bytes\n",n);
+ va_start(ap, fmt);
+ vsprintf(buf2, fmt, ap);
+ va_end(ap);
+ sys_gui(buf2);
+ free(buf2);
+ } else {
+ sys_gui(buf);
+ }
}
#define FIRSTPORTNUM 5400
- Previous message: [PD-cvs] pd/src m_class.c,1.1.1.2.2.6,1.1.1.2.2.7
- Next message: [PD-cvs] pd/src m_simd_sse_vc.c,1.1.2.10,1.1.2.11 m_simd_sse_vc.h,1.1.2.9,1.1.2.10 s_inter.c,1.1.1.3.2.21,1.1.1.3.2.22 s_path.c,1.1.1.2.2.5,1.1.1.2.2.6 t_tkcmd.c,1.1.1.4.2.1,1.1.1.4.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Pd-cvs
mailing list